I currently have a self-referencing join table without a primary key. If you’re familiar with Rails, I have a has_many_and_belongs_to relationship defined.
The join table is called users_users. One FK is friend_id and the other is user_id.
I want to change the relationship of this table to has_many and belongs_to (again, if you’re familiar with Rails). This means I need to a add a PK column.
What is the best way to do this?
Add a surrogate key
Should be all you have to do in MySQL, I don’t know about anything different pertaining to your model setup in Rails.