清除或重新创建 Ruby on Rails 数据库

问题描述:

我有一个充满数据的开发 Ruby on Rails 数据库.我想删除所有内容并重建数据库.我正在考虑使用类似的东西:

I have a dev Ruby on Rails database full of data. I want to delete everything and rebuild the database. I'm thinking of using something like:

rake db:recreate

这可能吗?

我知道两种方法:

这将重置您的数据库并重新加载您当前的架构:

This will reset your database and reload your current schema with all:

rake db:reset db:migrate

这将破坏您的数据库,然后创建它,然后迁移您当前的架构:

This will destroy your db and then create it and then migrate your current schema:

rake db:drop db:create db:migrate

在这两种情况下,所有数据都将丢失.

All data will be lost in both scenarios.