<p>Hi,</p>

<p>I'm afraid I don't understand how my change would not have fixed the case I mentioned. What I needed is SQLite to behave as other DB's with autoinc PKs and that is exactly what I achieved. Anyway, you're quite right that any change in SQLite generator should give a proper general solution that includes the case that you don't want autoinc with integers and my pull request didn't take that into account, so I understand it cannot be merged as it is now.</p>

<p>SQLite documentation suggests <a href="http://www.sqlite.org/lang_createtable.html#rowid">here</a> that the only thing that you have to do is to set the data_type to INT rather than INTEGER. I've tested it and it seems to work. I've created the following table:</p>

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

<p>and it won't accept null values for id</p>

<pre><code>sqlite&gt; insert into test_no_auto_int (a) values (1);
SQL error: test_no_auto_int.id may not be NULL
</code></pre>

<p>as it would accept it if we had created with INTEGER</p>

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

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

<p>We cannot create autoinc PKs with an INT datatype 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_int_auto</span> <span class="p">(</span>
  <span class="n">id</span> <span class="nb">INT</span> <span class="k">PRIMARY</span> <span class="k">KEY</span> <span class="n">AUTOINCREMENT</span> <span class="k">NOT</span> <span class="k">NULL</span><span class="p">,</span>
  <span class="n">a</span> <span class="nb">TEXT</span>
<span class="p">);</span>
</pre></div>

<p>as SQLite would complain:</p>

<pre><code>SQL error near line 1: AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY
</code></pre>

<p>I would say that my pull request should also contain modifications on <a href="https://github.com/dbsrgits/sql-translator/blob/master/lib/SQL/Translator/Generator/DDL/SQLite.pm#L66">SQL::Translator::Generator::DDL::SQLite::_ipk</a> subroutine to be correct, as INT and INTEGER are not equally considered by SQLite when creating tables.</p>

<p>I could take a look to that, amend the pull request and reopen it so that you can check if you're more comfortable with the solution.  Or if you want to take another route and I can be of any help, please let me know.</p>

<p>Regards</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-27632095'>view it on GitHub</a>.<img src='https://github.com/notifications/beacon/4W3BWTo7EIi_7vx28Xzl_uOeUxBDjNYWumjU51m-gOiLBMgmzsWdFwoWA5qcdsWE.gif' height='1' width='1'></p>