title: liquibase change primary key granularity
body: <p>I need to change a table to add a column and include it to the Primary Key.
  So I have a luiqbase changeset: </p>
  
  <p>I wonder how to separate concerns and implement rollback correctly.</p>
  
  <ol>
  <li><strong>addColumn and PK changes in one changeset</strong></li>
  </ol>
  
  <pre><code>&lt;changeSet author="rahul" id="change_pk"&gt;
          &lt;addColumn tableName="posts"&gt;
              &lt;column name="aux_id" type="INT" defaultValue="0"/&gt;
          &lt;/addColumn&gt;
          &lt;dropPrimaryKey tableName="posts"/&gt;
          &lt;addPrimaryKey tableName="posts" columnNames="id,aux_id"/&gt;
          &lt;rollback&gt;
            &lt;dropPrimaryKey tableName="posts"/&gt;
            &lt;addPrimaryKey tableName="posts" columnNames="id"/&gt;
          &lt;/rollback&gt;
      &lt;/changeSet&gt;
  </code></pre>
  
  <p>What concerns me in this approach is that if I am unable to create a column, I will drop PK and recreate it, which may affect DB response time, assuming the table is quite big. However, this makes all these changes atomic.</p>
  
  <ol start="2">
  <li><strong>Move PK changes to a different changeset</strong></li>
  </ol>
  
  <pre><code>&lt;changeSet author="rahul" id="add_col"&gt;
          &lt;addColumn tableName="posts"&gt;
              &lt;column name="aux_id" type="INT" defaultValue="0"/&gt;
          &lt;/addColumn&gt;
  &lt;/changeSet&gt;
  &lt;changeSet author="rahul" id="change_pk"&gt;
          &lt;dropPrimaryKey tableName="posts"/&gt;
          &lt;addPrimaryKey tableName="posts" columnNames="id,aux_id"/&gt;
          &lt;rollback&gt;
            &lt;dropPrimaryKey tableName="posts"/&gt;
            &lt;addPrimaryKey tableName="posts" columnNames="id"/&gt;
          &lt;/rollback&gt;
  &lt;/changeSet&gt;
  </code></pre>
  
  <p>Thus I will be able to have more control over rollback for PK changes, which will drop and recreate the old one. However, there is a problem, when <code>change_pk</code> changeset is not applied  - that I have a column, which should be included to a PK, but it is not, making system vulnerable to unique constraint violations.</p>