drop primary key liquibase code example

Example: liquibase add column to existing primary key

<changeSet author="yours_truly" id="EXAMPLE-02-01-dropPK">
    <dropPrimaryKey  tableName= "our_awesome_table" constraintName="CPK_OUR_AWESOME_TABLE"/>
 </changeSet>
 
 <changeSet author="yours_truly" id="EXAMPLE-02-01-addNNcol"> 
     <addColumn tableName="our_awesome_table">
         <column name="CREATED_AT" type="datetime" valueDate="current_datetime" defaultValueDate="current_datetime">
            <constraints nullable="false"/>
       </column>
    </addColumn>
</changeSet>

<changeSet author="yours_truly" id="EXAMPLE-02-02">
    <addPrimaryKey tableName="our_awesome_table" columnNames="source,external_id,CREATED_AT" constraintName="CPK_OUR_AWESOME_TABLE"/>
</changeSet>

Tags:

Sql Example