问题
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