renameView
Renames an existing Snowflake view, with support for cross-schema and cross-database moves.
Note: Automatic rollback renames the view back to original name.
Known limitation: 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 database containing the view to rename | No |
| String | Name of the schema containing the view to rename | No |
| String | Current name of the view | Yes |
| String | Target database name (for cross-database rename) | No |
| String | Target schema name (for cross-schema rename) | No |
| String | New name for the view | Yes |
| Boolean | If true, do not throw an error if the view doesn't exist | No |
<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 within current schema -->
<changeSet id="simple-rename" author="examples">
<pro-snowflake:renameView
oldViewName="OLD_VIEW"
newViewName="NEW_VIEW"/>
</changeSet>
<!-- Rename with explicit schema -->
<changeSet id="rename-with-schema" author="examples">
<pro-snowflake:renameView
oldSchemaName="PUBLIC"
oldViewName="OLD_VIEW"
newSchemaName="PUBLIC"
newViewName="NEW_VIEW"/>
</changeSet>
<!-- Cross-schema rename (move view to different schema) -->
<changeSet id="cross-schema-rename" author="examples">
<pro-snowflake:renameView
oldSchemaName="DEV_SCHEMA"
oldViewName="ANALYTICS_VIEW"
newSchemaName="PROD_SCHEMA"
newViewName="ANALYTICS_VIEW"/>
</changeSet>
<!-- Cross-database rename -->
<changeSet id="cross-database-rename" author="examples">
<pro-snowflake:renameView
oldCatalogName="DEV_DB"
oldSchemaName="PUBLIC"
oldViewName="REPORT_VIEW"
newCatalogName="PROD_DB"
newSchemaName="PUBLIC"
newViewName="REPORT_VIEW"/>
</changeSet>
<!-- Rename with IF EXISTS -->
<changeSet id="rename-if-exists" author="examples">
<pro-snowflake:renameView
oldViewName="OLD_VIEW"
newViewName="NEW_VIEW"
ifExists="true"/>
</changeSet>
</databaseChangeLog>