Alter Standard Table - Rename
Renames a standard table to a new name and optionally moves it to a different schema or catalog.
Known limitations:
This change type does not support automatic rollback.
Snowflake snapshots created with Liquibase Secure 5.1 are incompatible with earlier versions due to enhanced object type detection for TABLES and VIEWS. Regenerate all snapshots with 5.1 after upgrading to avoid false differences in diff and diff-changelog operations.
Available attributes
Attribute | Type | Description | Required |
|---|---|---|---|
| String | Name of the catalog (database) containing the table | No |
| String | Name of the schema containing the table | No |
| String | Name of the table to alter | Yes |
| Boolean | Only execute if the table exists | No |
renameTo nested attributes
Attribute | Type | Description | Required |
|---|---|---|---|
| String | New name for the table | Yes |
| String | New catalog (database) name | No |
| String | New schema name | 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-table" author="examples">
<pro-snowflake:alterStandardTable tableName="OLD_TABLE_NAME">
<pro-snowflake:renameTo newName="NEW_TABLE_NAME"/>
</pro-snowflake:alterStandardTable>
</changeSet>
<!-- Rename and move to different schema -->
<changeSet id="rename-and-move-table" author="examples">
<pro-snowflake:alterStandardTable
catalogName="MY_DATABASE"
schemaName="OLD_SCHEMA"
tableName="MY_TABLE">
<pro-snowflake:renameTo
newName="MY_RENAMED_TABLE"
newSchemaName="NEW_SCHEMA"/>
</pro-snowflake:alterStandardTable>
</changeSet>
</databaseChangeLog>