TYPO3 Extbase - Correct way to add unique-constraint?
<p>Does anybody know how to add an unique constraint to <code>ext_tables.sql</code> without creating problems like TYPO3 wanting to re-generate it every time you use the Database analyzer?</p>

<p>Example:</p>

<pre><code>CREATE TABLE tableName(
  CONSTRAINT unique_iban UNIQUE (iban) 
)

CREATE TABLE tableName(
  iban varchar(255) DEFAULT '' NOT NULL UNIQUE 
)
</code></pre>

<p>With both ways the database analyzer wants to create the constraints, even if they are already there.</p>

<p>First one additionally creates an error when you execute it: </p>

<blockquote>
  <p>Error: Duplicate key name 'unique_iban'</p>
</blockquote>

<p>Second one creates one new constraint every time you hit execute:</p>

<pre><code>ALTER TABLE tableName DROP KEY iban
ALTER TABLE tableName DROP KEY iban_2
</code></pre>

<p>etc.</p>