Destroy/Remove database in 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?


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

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.

This will get rid of the db:

rake db:drop 

And for each migration that you have:

rails d migration migration_name

Yes, Its possible to remove the database and migration.

rake db:drop
rake db:rollback
rails d migration 'migration name'
rake db:create
rake db:migrate
rake db:seed
rake db:test:prepare

Need Your Help

How to pre-populate the sms body text via an html link

html ios hyperlink sms

How to use an html link to open the sms app with a pre-filled body?

How can I change property names when serializing with

c# serialization

I have some data in a C# DataSet object. I can serialize it right now using a converter like this