I now manage a MySQL database that was designed and created by another.
I am confused about a certain setup that the original developer created..
He did not use auto increments for table IDs. Instead, he created a table called system_sequences which has two columns:
system_sequences.Table_Name
system_sequences.Next_Value
Here is an example of a table and how it currently inserts into the table (try my best):
there is a table called customer with an unique ID column.
If I want to insert into customer, currently I have to do the following:
SELECT system_sequences.Next_Value
FROM system_sequences
WHERE system_sequences.Table_Name = 'customer'
save the next_value into a variable and use it as the next ID for customer
then I have to:
UPDATE system_sequences
SET Next_Value = Next_Value + 1
WHERE system_sequences.Table_Name = 'customer'
I did not design this, I do not like it in any way shape or form ( I actually hate it ) and I want to convert everything carefully to auto_increment
But is there a reason for this or a benefit that I am not aware of? I have never seen anything like it before. And there is no documentation for this database that explains anything.