0

I can remove the id column with a migration action like this:

remove_column :my_table, :id

How can I make this call reversible? I want to restore the :id column with its whole capabilities when a rollback is performed.

Luis Masuelli
  • 12,079
  • 10
  • 49
  • 87
  • 3
    Possible duplicate of [How do you make remove\_column reversible?](http://stackoverflow.com/questions/24520550/how-do-you-make-remove-column-reversible) – Maxim Pontyushenko Mar 29 '16 at 16:14
  • You'd have to save the data away in another table and have a way to link id to your new primary key. You could use a table that your drop later after you've decided you won't rolblack – John Naegle Mar 29 '16 at 16:14
  • I will not use the ID again in the future. I created the ID by mistake (forgetting to put id: false). What I need is the parameters to recreate the ID (with pk and autoincrement). – Luis Masuelli Mar 29 '16 at 16:16

0 Answers0