Damien Roche Damien Roche - 3 years ago 179
Ruby Question

How to reload schema.rb in rails app?

I currently have a few migrations which were created when I initially created models using rails generate model. I've run those migrations and successfully updated the database.

I've then made some changes to these migrations (not added new ones) because they were very small changes like a new column, or making a column unique, or adding an index.

But, even when I reset my db and run all migrations again, rails is insisting on using an outdated schema.rb file.

What should I be doing? How do I force a reload of this schema.rb?

Answer Source

Provided you haven't pushed the code to production you can run rake db:rollback then rake db:migrate to drop and recreate the tables.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download