renameRole

Renames an existing role in Snowflake.

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

oldRoleName

String

Current name of the role

Yes

newRoleName

String

New name for the role

Yes

ifExists

Boolean

Only rename if the role exists using IF 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-role-basic" author="examples">
    <pro-snowflake:renameRole
                oldRoleName="DATA_ANALYST_ROLE"
                newRoleName="ANALYTICS_ROLE"/>
  </changeSet>
  <!-- Rename with IF EXISTS -->
  <changeSet id="rename-role-if-exists" author="examples">
    <pro-snowflake:renameRole
                oldRoleName="ANALYTICS_ROLE"
                newRoleName="SENIOR_ANALYST_ROLE"
                ifExists="true"/>
  </changeSet>
</databaseChangeLog>