title: With Liquibase, is there a difference between using a unique <createIndex> and using <column> with a unique constraint?
body: <p>Liquibase has two ways to define a column as unique:</p>
  
  <ol>
  <li><p>When creating the table, using <a href="http://www.liquibase.org/documentation/column.html" rel="noreferrer"><code>&lt;constraints&gt;</code></a> on the column:</p>
  
  <pre><code>&lt;createTable tableName="my_table"&gt;
      &lt;column name="my_column"&gt;
          &lt;constraints unique="true"
                       uniqueConstraintName="my_table_my_column_uk"&gt;
      &lt;/column&gt;
  &lt;/createTable&gt;
  </code></pre></li>
  <li><p>After creating the table, using <a href="http://www.liquibase.org/documentation/changes/create_index.html" rel="noreferrer"><code>&lt;createIndex&gt;</code></a>:</p>
  
  <pre><code>&lt;createTable tableName="my_table"&gt;
      &lt;column name="my_column"/&gt;
  &lt;/createTable&gt;
  &lt;createIndex tableName="my_table" unique="true"
               indexName="my_table_my_column_uk"&gt;
      &lt;column name="my_column"/&gt;
  &lt;/createIndex&gt;
  </code></pre></li>
  </ol>
  
  <p><strong>Is there any difference between these two approaches for single-column unique keys?</strong></p>
  
  <p>In my own observations with MySQL, <strong>there seems to be no difference</strong>. Both declarations (above) yield the same <code>SHOW CREATE TABLE</code> result:</p>
  
  <pre><code>...
  UNIQUE_KEY `my_table_my_column_uk` (`my_column`)
  ...
  </code></pre>
  
  <p>However, does this hold true for <strong>all database implementations</strong>, or does <code>&lt;createIndex unique="true"&gt;</code> generate different schema output from <code>&lt;constraint unique="true"/&gt;</code> for different databases?</p>
  
  <p><em>Background: I have a script that has built the liquibase changelog directly from my relational model in the code. The generation script created BOTH declarations if the model indicated the column was unique. I'm cleaning up the generated results and would like to remove one of the declarations, and want to know if that's appropriate.</em></p>