I have a table that needs to be given a new primary key, as my predecesor used a varchar(8) row as the primary key, and we are having problems with it now. I know how to add the primary key, but am not sure of the correct way to add this new primary key to other tables that have the foreign key. Here is what I have:
users table:
old_user_id varchar(8)
...
...
new_user_id int
orders table:
order_id int
...
...
old_user_fk varchar(8)
new_user_fk int(11)
I need to get the same results whether I join the tables on users.old_user_id=orders.old_user_fk
or users.new_user_id=orders.new_user_fk
. Any help is appreciated.