<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:arial, helvetica, sans-serif;font-size:12pt;color:#7f003f;"><DIV></DIV>
<DIV>What is the correct order for adding an auto-increment to a table? Obviously this is not it:</DIV>
<DIV><FONT face="Courier New, courier, monaco, monospace, sans-serif" color=#6000bf>&nbsp; db_drop_primary_key($ret, 'client_activity');<BR>&nbsp; db_add_field($ret, 'client_activity', 'id', array(<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'type' =&gt; 'serial',<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'not null' =&gt; TRUE,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'description' =&gt; 'Primary Key: Unique row ID.',<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ));<BR>&nbsp; db_add_primary_key($ret, 'client_activity', 'id');<BR>&nbsp; db_add_index($ret, 'client_activity', 'tnt', array('timestamp', 'nid', 'type'));<BR></FONT></DIV>
<DIV>This gets these errors at update.php:</DIV>
<DIV>
<LI><FONT color=#ff0000>user warning: Incorrect table definition; there can be only one auto column and it must be defined as a key query: update_sql /* admin : update_sql */ ALTER TABLE client_activity ADD `id` INT auto_increment DEFAULT NULL in C:\www\webapps\drupal6\includes\database.mysql-common.inc on line 298.</FONT></LI>
<LI><FONT color=#ff0000>user warning: Unknown column 'id' in 'client_activity' query: update_sql /* admin : update_sql */ ALTER TABLE client_activity CHANGE `id` `id` INT NOT NULL auto_increment in C:\www\webapps\drupal6\includes\database.mysql-common.inc on line 520.</FONT></LI>
<LI><FONT color=#ff0000>warning: Invalid argument supplied for foreach() in C:\www\webapps\drupal6\includes\database.mysql-common.inc on line 109.</FONT></LI>
<LI><FONT color=#ff0000>user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 query: update_sql /* admin : update_sql */ ALTER TABLE client_activity ADD PRIMARY KEY () in C:\www\webapps\drupal6\includes\database.mysql-common.inc on line 374.</FONT></LI></DIV>
<DIV><BR>&nbsp;</DIV>
<P><FONT face="bookman old style, new york, times, serif" color=#ff007f size=4><EM><STRONG>Nancy</STRONG></EM></FONT></P>
<P><FONT face="arial, helvetica, sans-serif">Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.</FONT></P>
<DIV></DIV></div></body></html>