alterRoleComment
Sets or removes the comment on an existing role in Snowflake.
Attributes
Attribute | Type | Description | Required |
|---|---|---|---|
roleName | String | Name of the role to alter | Yes |
ifExists | Boolean | If true, only alters if the role exists using `IF EXISTS` | No |
newComment | String | New comment text to set. At least one of `newComment` or `unsetComment` must be specified. | No |
unsetComment | Boolean | If true, removes the existing comment. At least one of `newComment` or `unsetComment` must be specified. | 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">
<changeSet id="set-role-comment" author="examples">
<!-- Create role -->
<sql>CREATE ROLE IF NOT EXISTS ANALYTICS_ROLE</sql>
<!-- Set comment - this is what we're testing -->
<pro-snowflake:alterRoleComment
roleName="ANALYTICS_ROLE"
newComment="Role for data analytics with read-only access"/>
<rollback>
<pro-snowflake:alterRoleComment roleName="ANALYTICS_ROLE" unsetComment="true"/>
</rollback>
</changeSet>
<changeSet id="unset-role-comment" author="examples">
<!-- Create role with comment -->
<sql>CREATE ROLE IF NOT EXISTS SERVICE_ACCOUNT_ROLE COMMENT = 'Service account role for API access'</sql>
<!-- Unset comment - this is what we're testing -->
<pro-snowflake:alterRoleComment
roleName="SERVICE_ACCOUNT_ROLE"
unsetComment="true"/>
<rollback>
<pro-snowflake:alterRoleComment
roleName="SERVICE_ACCOUNT_ROLE"
newComment="Service account role for API access"/>
</rollback>
</changeSet>
<changeSet id="set-comment-if-exists" author="examples">
<!-- Set comment with IF EXISTS clause -->
<pro-snowflake:alterRoleComment
roleName="SENIOR_ANALYST_ROLE"
newComment="Updated role for senior data analysts"
ifExists="true"/>
</changeSet>
<changeSet id="set-comment-special-chars" author="examples">
<!-- Set comment with single quotes -->
<pro-snowflake:alterRoleComment
roleName="SENIOR_ANALYST_ROLE"
newComment="Role for 'senior-level' analysts with elevated privileges"/>
</changeSet>
</databaseChangeLog>