I have a mySQL table of users whose primary key is an auto-incrementing integer. The table is already populated with records whose key is between 0 and 30.000. Not all records are there, though. Some users have been removed and therefore I have "holes".
Now the client has realised they removed a bunch of users by mistake, and they now want me to reinsert those users keeping the same ID they had, for compatibility with the back-end of the e-commerce, which runs on a different machine altogether, but uses the same ID's for the customers.
At the moment I am:
- altering the structure of the table, by removing the auto_increment property from the ID
- adding the records I need, specifying their ID
- reverting the alterations to the structure of the table.
Is there a better way to achieve this? Is there any SQL override
function that would allow me to force MySQL to accept a value that is unique but not necessarily "the next number in the line"?
Thank you in advance for your time!