Web and App Development Commands

Rails Database Commands

db:version
Prints the current schema version.
Last Updated on JUL 07 2020
db:migrate:rollback
Rolls back the last migration.
Last Updated on JUL 07 2020
db:migrate:status
Displays the current migration status.
Last Updated on JUL 07 2020
db:migrate:down
Runs the down for the given migration VERSION.
Last Updated on JUL 07 2020
db:migrate:up
Runs the up for the given migration VERSION.
Last Updated on JUL 07 2020
db:migrate:redo
Runs db:migrate:down and db:migrate:up or db:migrate:rollback and db:migrate:up depending on the specified migration. I usually run this after creating and running a new migration to ensure the migration is reversable.
Last Updated on JUL 07 2020
db:migrate
Runs migrations for the current environment that have not run yet. By default it will run migrations only in the development environment.
Last Updated on JUL 07 2020
db:drop:all
Drops the database for all environments.
Last Updated on JUL 07 2020
db:drop
Drops the database for the current RAILS_ENV environment. If RAILS_ENV is not specified it defaults to the development and test databases.
Last Updated on JUL 07 2020
db:create:all
Creates the database for all environments. Creates the database for all environments.
Last Updated on JUL 07 2020
db:create
Creates the database for the current RAILS_ENV environment. If RAILS_ENV is not specified it defaults to the development and test databases.
Last Updated on JUL 07 2020