alterSequence
Modifies properties of an existing sequence in Snowflake. This allows you to change the increment value and ordering behavior without recreating the sequence.
Note: This change type does not support automatic rollback or database inspection features (snapshot, diff, diff-changelog, and generate-changelog commands).
Available attributes
Attribute | Type | Description | Required |
|---|---|---|---|
| String | Name of the catalog (database) containing the sequence | No |
| String | Name of the schema containing the sequence | No |
| String | Name of the sequence to alter | Yes |
| Boolean | Don't error if the sequence doesn't exist using IF EXISTS | No |
| Long | New value to increment by for each sequence value* | No |
| Boolean | New ordering behavior (true for ORDER, false for NOORDER)* | No |
* At least one of incrementBy or ordered must be specified.
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:pro-snowflake="http://www.liquibase.org/xml/ns/pro-snowflake"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd
http://www.liquibase.org/xml/ns/pro-snowflake
http://www.liquibase.org/xml/ns/pro-snowflake/liquibase-pro-snowflake-latest.xsd">
<!-- Change increment -->
<changeSet id="alter-sequence-increment" author="examples">
<pro-snowflake:alterSequence
sequenceName="ORDER_ID_SEQ"
incrementBy="10"/>
</changeSet>
<!-- Change ordering -->
<changeSet id="alter-sequence-ordering" author="examples">
<pro-snowflake:alterSequence
sequenceName="ORDER_ID_SEQ"
ordered="false"/>
</changeSet>
<!-- Change both with IF EXISTS -->
<changeSet id="alter-sequence-both" author="examples">
<pro-snowflake:alterSequence
sequenceName="INVOICE_SEQ"
ifExists="true"
incrementBy="5"
ordered="true"/>
</changeSet>
</databaseChangeLog>