销毁/ Rails中删除数据库 [英] Destroy/Remove database in Rails
本文介绍了销毁/ Rails中删除数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有可能从现有的应用程序完全删除数据库和所有迁移记录等,所以我可以从头开始重新设计数据库?
Is it possible to completely remove the database and all migration records etc from an existing application so I can redesign the database from scratch?
推荐答案
通过发出耙-T
您有以下数据库任务:
By issuing rake -T
you have the following database tasks:
rake db:create # Create the database from DATABASE_URL or config/database.yml for the current Rails.env (use db:create:all to create all dbs in the config)
rake db:drop # Drops the database using DATABASE_URL or the current Rails.env (use db:drop:all to drop all databases)
rake db:fixtures:load # Load fixtures into the current environment's database
rake db:migrate # Migrate the database (options: VERSION=x, VERBOSE=false)
rake db:migrate:status # Display status of migrations
rake db:rollback # Rolls the schema back to the previous version (specify steps w/ STEP=n)
rake db:schema:dump # Create a db/schema.rb file that can be portably used against any DB supported by AR
rake db:schema:load # Load a schema.rb file into the database
rake db:seed # Load the seed data from db/seeds.rb
rake db:setup # Create the database, load the schema, and initialize with the seed data (use db:reset to also drop the db first)
rake db:structure:dump # Dump the database structure to db/structure.sql
rake db:version # Retrieves the current schema version number
因此,为了发行捆绑EXEC耙分贝:滴:所有
,如果你想删除所有的迁移,并假设你想只删除迁移,删除它们,写新的。
So to issue bundle exec rake db:drop:all
and if you want to remove all the migrations, and assuming you want to remove only the migrations, delete them and write new ones.
如果你想改变你的型号太多,使用轨三维模型
。
If you want to change your models too, use rails d model
.
这篇关于销毁/ Rails中删除数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文