addStandardTableColumn

Adds a new column to an existing Snowflake standard table.

Note: This change type does not support automatic rollback.

Available attributes

Attribute

Type

Description

Required

catalogName

String

Name of the catalog (database) containing the table

No

schemaName

String

Name of the schema containing the table

No

tableName

String

Name of the table to add the column to

Yes

columnName

String

Name of the new column

Yes

columnType

String

Data type of the new column

Yes

ifTableExists

Boolean

Only execute if the table exists

No

ifNotExists

Boolean

Only add column if it doesn't already exist

No

nullable

Boolean

If false, adds NOT NULL constraint

No

collation

String

Column collation specification

No

comment

String

Column comment

No

Default value attributes

Only one default value attribute should be specified:

Attribute

Type

Description

Required

defaultValue

String

Default string value

No

defaultValueNumeric

String

Default numeric value

No

defaultValueBoolean

Boolean

Default boolean value

No

defaultValueDate

String

Default date value (yyyy-MM-dd format)

No

defaultValueComputed

String

Computed default expression

No

defaultValueSequenceNext

String

Sequence name for NEXTVAL default

No

defaultValueSequenceCurrent

String

Sequence name for CURRVAL default

No

Snowflake-specific attributes

Attribute

Type

Description

Required

maskingPolicy

String

Name of masking policy to apply

No

maskingPolicyUsing

String

Additional columns for conditional masking

No

projectionPolicy

String

Name of projection policy to apply

No

tags

Object

Map of tag names to values

No

Basic column

<?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">
  <!-- Add a basic column -->
  <changeSet id="add-basic-column" author="examples">
    <pro-snowflake:addStandardTableColumn
            tableName="CUSTOMERS"
            columnName="PHONE_NUMBER"
            columnType="VARCHAR(20)"/>
  </changeSet>
  <!-- Add a NOT NULL column with default -->
  <changeSet id="add-not-null-column" author="examples">
    <pro-snowflake:addStandardTableColumn
            tableName="CUSTOMERS"
            columnName="STATUS"
            columnType="VARCHAR(10)"
            nullable="false"
            defaultValue="ACTIVE"/>
  </changeSet>
  <!-- Add column only if it doesn't exist -->
  <changeSet id="add-column-if-not-exists" author="examples">
    <pro-snowflake:addStandardTableColumn
            tableName="CUSTOMERS"
            columnName="CREATED_AT"
            columnType="TIMESTAMP_NTZ"
            ifNotExists="true"
            defaultValueComputed="CURRENT_TIMESTAMP()"/>
  </changeSet>
</databaseChangeLog>

Column with policies and tags

<?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">
  <!-- Add column with masking policy -->
  <changeSet id="add-column-with-masking" author="examples">
    <pro-snowflake:addStandardTableColumn
            tableName="CUSTOMERS"
            columnName="SSN"
            columnType="VARCHAR(11)"
            maskingPolicy="SSN_MASK"
            comment="Social Security Number (masked)"/>
  </changeSet>
  <!-- Add column with tags -->
  <changeSet id="add-column-with-tags" author="examples">
    <pro-snowflake:addStandardTableColumn
            tableName="CUSTOMERS"
            columnName="EMAIL"
            columnType="VARCHAR(255)">
      <pro-snowflake:tags>
        <pro-snowflake:entry key="PII" value="true"/>
        <pro-snowflake:entry key="SENSITIVITY" value="HIGH"/>
      </pro-snowflake:tags>
    </pro-snowflake:addStandardTableColumn>
  </changeSet>
  <!-- Add column with projection policy -->
  <changeSet id="add-column-with-projection" author="examples">
    <pro-snowflake:addStandardTableColumn
            tableName="SENSITIVE_DATA"
            columnName="SECRET_KEY"
            columnType="VARCHAR(256)"
            projectionPolicy="NO_PROJECTION"/>
  </changeSet>
</databaseChangeLog>

Column with collation

<?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">
  <!-- Add column with case-insensitive collation -->
  <changeSet id="add-column-with-collation" author="examples">
    <pro-snowflake:addStandardTableColumn
            tableName="CUSTOMERS"
            columnName="COUNTRY"
            columnType="VARCHAR(100)"
            collation="en-ci"/>
  </changeSet>
</databaseChangeLog>