简体   繁体   English

耙db:drop无法正常工作?

[英]Rake db:drop not working?

I have unseen duplicate relations and tables and I am trying to destroy my entire DB and reset out of pure frustration, and I can't even do that. 我看不见重复的关系和表,并且我试图破坏我的整个数据库并从无奈中恢复过来,我什至不能这样做。 When I run rake db:drop or reset, everything is still there in my schema and migrations. 当我运行rake db:drop或reset时,架构和迁移中的所有内容仍然存在。 How do I kill this entire DB and build it over again? 如何杀死整个数据库并重新构建?

While they are closely related, migration files / schema.rb are not the same thing as the database. 尽管migration files / schema.rb与它们密切相关,但它们与数据库却不是同一回事。 rake db:drop doesn't delete the migration files or the schema because people may wish to easily recreate their entire database while maintaining the information on how the database was built (ie the migration files). rake db:drop不会删除迁移文件或架构,因为人们可能希望轻松地重新创建他们的整个数据库,同时保留有关如何构建数据库的信息(即迁移文件)。

If you want to start from scratch, drop the database rake db:drop and manually delete the migration files (schema will be overwritten when you create your new migrations). 如果要从头开始,请删除数据库rake db:drop并手动删除迁移文件(在创建新迁移时,架构将被覆盖)。

If you do 如果你这样做

rake db:rollback STEP=100

That will revert the last 100 migrations (so take you to zero state) 这将还原最近的100次迁移(因此将您带到零状态)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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