I created a table without a primary key (: id = & gt; wrong), but now it's back Cutting my ass
My app is already in production and I can not leave it and the second one can rebuild.
Is there a way to run a migration to add another auto increment primary key column to my table?
The command to add the primary key to the migration is:
However, the word of your question indicates that there is already an automatic increment column in your table until I am making a mistake, There are several DBMS that do not allow more than one auto-increment column from one table. If you already have an automatic increment column and you really want to use that column as your primary key, just add the following to your model: In this case that you already have an auto-increment column and you can not use it as the primary key Get out of. add_column : My_table ,: id,: primary_key
self.primary_key = "my_existing_column"
Comments
Post a Comment