Is Auto_Increment supported in Oracle using Liquibase

≯℡__Kan透↙ 提交于 2021-02-10 14:30:02

问题


I want to add an auto_increment column in an oracle database using liquibase script.

I have tried using the auto_increment attribute in liquibase :

<column name="SUPPLEMENT_ID" type="INTEGER" autoIncrement="true" >
<constraints primaryKey="true"></constraints> 
</column>

If oracle supports auto_increment, how can I achieve it using liquibase scripts?


回答1:


IDENTITY columns are introduced in oracle 12c which allows users to create auto increment columns

But if you are using older versions you have to model the column with sequence and triggers as there is no such option as auto_increment or identity.

Please see this answer on how to do it in both cases https://stackoverflow.com/a/11296469/8330426




回答2:


According to @APC's comment under the question, Liquibase supports Oracle auto increment since version 3.4.0. See https://liquibase.jira.com/browse/CORE-1731.



来源:https://stackoverflow.com/questions/57151627/is-auto-increment-supported-in-oracle-using-liquibase

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!