renameSequence

Renames an existing sequence in Snowflake.

Note: Automatic rollback renames the sequence back to original name.

Known limitation: This change type does not support database inspection features (snapshot, diff, diff-changelog, and generate-changelog commands).

Available attributes

Attribute

Type

Description

Required

catalogName

String

Name of the catalog (database) containing the sequence

No

schemaName

String

Name of the schema containing the sequence

No

oldSequenceName

String

Current name of the sequence

Yes

newSequenceName

String

New name for the sequence

Yes

ifExists

Boolean

Don't error if the sequence doesn't exist

No

<?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">
  <!-- Simple rename -->
  <changeSet id="rename-sequence" author="examples">
    <pro-snowflake:renameSequence
                oldSequenceName="OLD_SEQ"
                newSequenceName="NEW_SEQ"/>
  </changeSet>
  <!-- Rename with IF EXISTS -->
  <changeSet id="rename-sequence-if-exists" author="examples">
    <pro-snowflake:renameSequence
                oldSequenceName="TEMP_SEQ"
                newSequenceName="PERMANENT_SEQ"
                ifExists="true"/>
  </changeSet>
  <!-- Rename with schema qualification -->
  <changeSet id="rename-sequence-with-schema" author="examples">
    <pro-snowflake:renameSequence
                schemaName="ANALYTICS"
                oldSequenceName="ORDER_SEQ"
                newSequenceName="INVOICE_SEQ"/>
  </changeSet>
</databaseChangeLog>