On 30/03/2006 12:31 p.m., Daniel Kasak wrote:
[EMAIL PROTECTED] wrote:
I suppose that would be alot easier than trying to bump the PK and
related FK values of the whole table by 1, just to give the first row
in the table the auto_increment value of 1?
Yes. That sounds messy.
What about before migrating the database, just adding a new row to the
end of the table, that would duplicate the data in the first row, then
deleting the first row from the table?
Would that work?
Yes but it would be no different to just updating the primary key of the
existing record.
Either way, you will have issues with restoring from backups if you keep
an auto_increment column with a zero value around ( as you've discovered
), so what ever you do, you need to get rid of those zero values.
Another option would be to reassign the zero row to be -1 (if the column
is not UNSIGNED). Assuming the current zero row has some kind of special
significance, this may make more sense than just giving it the next
unused auto_increment value. This would also keep it in the same place
with an ORDER BY.
-Simon
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]