alterRoleComment

Sets or removes the comment on an existing role in Snowflake.

Note: This change type does not support automatic rollback or database inspection features (snapshot, diff, diff-changelog, and generate-changelog commands).

Available attributes

Attribute

Type

Description

Required

roleName

String

Name of the role to alter

Yes

ifExists

Boolean

Only alter if the role exists using IF EXISTS

No

newComment

String

New comment text to set*

No

unsetComment

Boolean

Remove the existing comment*

No

* Exactly one of newComment or unsetComment must be specified

<?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">
  <!-- Set comment -->
  <changeSet id="role-set-comment" author="examples">
    <pro-snowflake:alterRoleComment
                roleName="ANALYTICS_ROLE"
                newComment="Role for data analytics with read-only access"/>
  </changeSet>
  <!-- Set comment with IF EXISTS -->
  <changeSet id="role-set-comment-if-exists" author="examples">
    <pro-snowflake:alterRoleComment
                roleName="SENIOR_ANALYST_ROLE"
                newComment="Updated role for senior data analysts"
                ifExists="true"/>
  </changeSet>
  <!-- Unset comment -->
  <changeSet id="role-unset-comment" author="examples">
    <pro-snowflake:alterRoleComment
                roleName="SERVICE_ACCOUNT_ROLE"
                unsetComment="true"/>
  </changeSet>
</databaseChangeLog>