简体   繁体   中英

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?

如果您没有将代码推送到生产环境,则可以运行rake db:rollback然后rake db:migrate to drop并重新创建表。

Use this:

rake db:drop db:create db:migrate

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM