I use the GUID as the primary key for all my other tables, but I have a requirement that must have an increasing number. I tried to create a field in a table with auto-increment, but MySql complained that it should be a primary key.
My application uses MySql 5, nhibernate as ORM.
Possible solutions that I thought of:
change the primary key to the auto-increment field, but still make sure the GUID so that the rest of my application is consistent.
Create a composite key with both a GUID and an auto-increment field.
My thoughts are currently leaning towards the idea of โโa composite key.
EDIT: The row identifier (primary key) is the current GUID. I would like to add an INT field that is automatically added so that it is human readable. I just did not want to move away from the current standard in the application with the GUID as primary keys.
source
share