title: Liquibase SQL error -- adds column which is not null to table with existing data
body: <p>I am trying to use Liquibase to transform one database into another.  I have two databases and would like to run a SQL script on one to make it the same as the other one.  I am using Liquibase version 3.4.1 and two H2 databases.  In order to generate the SQL script I first generate the diff xml using the diffChangeLog command which works fine. (Actually there is one problem: it generates columns which are of type VARCHAR with autoIncrement set to true, but that can be manually removed).  I then use the command updateSQL to generate the SQL file from the diff xml.  The SQL file contains the line:</p>
  <pre><code>ALTER TABLE PUBLIC.USERS ADD ENABLED BOOLEAN(1) NOT NULL; 
  </code></pre>
  <p>Originally the db contains a table named USERS with two columns: USER and PASSWORD with one row of data (user1, password).  The SQL script fails at that point as it tries to create a new column whose entry for the first row will be set to NULL but the column is supposed to be NOT NULL.  The error is:</p>
  <blockquote>
  <p>Error: NULL not allowed for column &quot;ENABLED&quot;;</p>
  <p>SQL statement:
  <code>ALTER TABLE PUBLIC.USERS ADD ENABLED BOOLEAN(1) NOT NULL</code> [23502-187]</p>
  <p>SQLState:  23502</p>
  <p>ErrorCode: 23502</p>
  <p>Error occured in: <code>ALTER TABLE PUBLIC.USERS ADD ENABLED BOOLEAN(1) NOT NULL</code></p>
  </blockquote>
  <p>I could try to delete the NOT NULL condition manually, but this doesn't work in all cases as described below.  When I do remove the NOT NULL, this is what happens:</p>
  <p>Another related error occurs when the following line is executed (right after the one above):</p>
  <pre><code>ALTER TABLE PUBLIC.USERS ADD USERNAME VARCHAR(50) NOT NULL;  
  </code></pre>
  <p>Note that it is trying to add the column &quot;USERNAME&quot;, not &quot;USER&quot;, which the original database already has.</p>
  <p>It gives the same error, and when I remove NOT NULL, another error comes up:</p>
  <blockquote>
  <p>Error: Column &quot;USERNAME&quot; must not be nullable;</p>
  <p>SQL statement:<code>ALTER TABLE PUBLIC.USERS ADD CONSTRAINT CONSTRAINT_4 PRIMARY KEY (USERNAME)</code> [90023-187]</p>
  <p>SQLState:  90023</p>
  <p>ErrorCode: 90023</p>
  <p>Error occured in: <code>ALTER TABLE PUBLIC.USERS ADD CONSTRAINT CONSTRAINT_4 PRIMARY KEY (USERNAME)</code></p>
  </blockquote>
  <p>Since the column is a primary key it must not be nullable.</p>
  <p>Is there a way to fix this easily?  Is there an option in Liquibase which would get rid of these errors?</p>