renameDatabase

Renames an existing database in Snowflake. This operation changes the database identifier while preserving all schemas, tables, and other objects.

Note: Automatic rollback renames the database 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

oldDatabaseName

String

Current name of the database to rename

Yes

newDatabaseName

String

New name for the database

Yes

ifExists

Boolean

Only execute if the database exists

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">
  <!-- Basic rename -->
  <changeSet id="rename-database-basic" author="examples">
    <pro-snowflake:renameDatabase
            oldDatabaseName="OLD_DATABASE"
            newDatabaseName="NEW_DATABASE"/>
  </changeSet>
  <!-- Rename with IF EXISTS -->
  <changeSet id="rename-database-if-exists" author="examples">
    <pro-snowflake:renameDatabase
            oldDatabaseName="OLD_DATABASE"
            newDatabaseName="NEW_DATABASE"
            ifExists="true"/>
  </changeSet>
</databaseChangeLog>