0

Sorry, I not familiar to Rails. I just wanna know how to apply add_index , after I've already done the migration file by db:migrate

add_index :categories_products,
          [:category_id, :product_id], unique: true

I tried to edit the migrate and go db:migrate , it seems nothing happens.

newBike
  • 14,385
  • 29
  • 109
  • 192

1 Answers1

0

Well, if all you want to do is edit the migration, and re-migrate try this:

if you only need to go back one migration:

rake db:rollback

or if you need to step back, multiple migrations:

rake db:rollback STEP=3

Then, edit your migration to add the index, and finish it off with:

rake db:migrate

hope that helps! :-)

TuK
  • 3,556
  • 4
  • 24
  • 24