使用 oracle 更改 Liquibase 中的序列
Changing the sequence in Liquibase with oracle
我有一个 table X
几年前在 Liquibase 中创建的,没有序列。最近,通过执行以下步骤尝试进行更正:
- 用
startValue=2000
创建了一个序列;
- 创建了一个新的临时文件 table(Y),在 ID 列上使用该序列;
- 将所有数据从 table X 移动到 table Y;
- 已删除 table X;
- 已将 table Y 重命名为 X;
现在这些更改已推送到产品中。他们要求我将 sequence
从 2000 年更改为 2050 年。
我之前从未使用过 Liquibase;我的想法是删除该序列并使用 startValue=2050
.
创建一个新序列
但我不确定是否有更好的方法。
感谢您的帮助!
这种方式对我有用:
<changeSet author="ml" id="20200730-sequence">
<dropSequence sequenceName="seq_id"/>
<createSequence
sequenceName="seq_id"
startValue="2050"
incrementBy="1"
ordered="true"/>
</changeSet>
我有一个 table X
几年前在 Liquibase 中创建的,没有序列。最近,通过执行以下步骤尝试进行更正:
- 用
startValue=2000
创建了一个序列; - 创建了一个新的临时文件 table(Y),在 ID 列上使用该序列;
- 将所有数据从 table X 移动到 table Y;
- 已删除 table X;
- 已将 table Y 重命名为 X;
现在这些更改已推送到产品中。他们要求我将 sequence
从 2000 年更改为 2050 年。
我之前从未使用过 Liquibase;我的想法是删除该序列并使用 startValue=2050
.
但我不确定是否有更好的方法。
感谢您的帮助!
这种方式对我有用:
<changeSet author="ml" id="20200730-sequence">
<dropSequence sequenceName="seq_id"/>
<createSequence
sequenceName="seq_id"
startValue="2050"
incrementBy="1"
ordered="true"/>
</changeSet>