在Rails中销毁/删除数据库
发布时间:2020-12-12 16:32:58 所属栏目:MsSql教程 来源:网络整理
导读:是否可以从现有应用程序中完全删除数据库和所有迁移记录等,以便我可以从头重新设计数据库? 解决方法 通过发出rake -T,您有以下数据库任务: rake db:create # Create the database from DATABASE_URL or config/database.yml for the current Rails.env (use
是否可以从现有应用程序中完全删除数据库和所有迁移记录等,以便我可以从头重新设计数据库?
解决方法通过发出rake -T,您有以下数据库任务: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 所以要发布bundle exec rake db:drop:all,如果要删除所有迁移,并且假设您只想删除迁移,请删除它们并编写新的迁移. 如果您也想改变模型,请使用rails d模型. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- sql – Sybase ASE:“您的服务器命令遇到死锁情况”
- sql – 获取envelope.i.e重叠时间跨度
- sql – 如何在Oracle 11g中将分区表从一个表空间移动到另一
- Sql Server 2016新功能之Row-Level Security(值得关注)
- SQL Server查找所有包含了某个文本的存储过程
- mysql5.0版本下载地址集合
- SQLServer2000在64位电脑的安装步骤
- SQLServer创建视图
- DBCC大全集之(适用版本MS SQLServer 2008 R2)----DBCC CH
- sql-server – 从Excel导入SQL Server 2005的截断错误