<p>Hi,</p>

<p>Sorry for not having commented anything before. I've just seen the discussion and the commit reversion. The way it is now leaves people like me with problems when we want to check that an autoincrement primary key always grows, as we see it in MySQL with InnoDB and MyISAM engines. Being no expert at all in Postgres, I've installed locally and seems to behave as MySQL using SERIAL datatype instead of autoincrements.</p>

<p>The problem comes from SQLite autoincrementing even when it is not told so. If you create a table in SQLite without an autoincrement in the primary key as in the following example</p>

<div class="highlight highlight-sql"><pre><span class="k">CREATE</span> <span class="k">TABLE</span> <span class="n">test</span> <span class="p">(</span>
  <span class="n">id</span> <span class="nb">integer</span> <span class="k">NOT</span> <span class="k">NULL</span><span class="p">,</span>
  <span class="n">a</span> <span class="nb">integer</span> <span class="k">NOT</span> <span class="k">NULL</span><span class="p">,</span>
  <span class="n">b</span> <span class="nb">integer</span> <span class="k">NOT</span> <span class="k">NULL</span><span class="p">,</span>
  <span class="k">PRIMARY</span> <span class="k">KEY</span>  <span class="p">(</span><span class="n">id</span><span class="p">)</span>
<span class="p">);</span>
</pre></div>

<p>it will automagically autoincrement values for <em>id</em> when you insert</p>

<pre><code>sqlite&gt; insert into test (a, b) values (1,2);
sqlite&gt; insert into test (a, b) values (1,2);
sqlite&gt; select * from test;
1|1|2
2|1|2
</code></pre>

<p>which is something quite particular to SQLite, as you won't see that behaviour in other databases such as MySQL or Postgres. The documentation warns that it will perform a bit slower and that you should only use it when needed. </p>

<p>This problem came as I was expecting increasing values of autoincrement primary keys in SQLite, as I run my test suite against SQLite when developing but it can also work against MySQL with an env variable, which is quite convenient for me.</p>

<p>There should be a way to tell SQL-Translator to behave as other databases do with autoincrement primary keys even if we want the default behaviour to remain as it is now (ignoring is_auto_increment as SQLite will do it for you even if you didn't ask for it). Maybe we could do it with another property like <em>sqlite_auto_increment</em> that would only make sense for SQLite as it would be ignored by other producers as far as I know.</p>

<p>If this approach makes sense to you, I can try to implement it and submit a pull request.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">&mdash;<br>Reply to this email directly or <a href='https://github.com/dbsrgits/sql-translator/pull/26#issuecomment-27630029'>view it on GitHub</a>.<img src='https://github.com/notifications/beacon/4W3BWTo7EIi_7vx28Xzl_uOeUxBDjNYWumjU51m-gOiLBMgmzsWdFwoWA5qcdsWE.gif' height='1' width='1'></p>