dimanche 9 septembre 2018

Rails migration to add Primary Key to Existing table

I have a table with two columns employee_id and manager_id without primary key in Mysql. I have a setup a many-to-many relationship between Employee and Employee_Manager table.In order to update a record i need a primary key on Employee_Manager table.Hence, in rails how can generate a migration which add a comun to existing table id(primary key) and set row value for all records in existing table.

Aucun commentaire:

Enregistrer un commentaire