LinuxCommandLibrary

rails-db

rails-db

TLDR

Create databases, load the schema, and initialize with seed data

$ rails db:setup
copy


Access the database console
$ rails db
copy


Create the databases defined in the current environment
$ rails db:create
copy


Destroy the databases defined in the current environment
$ rails db:drop
copy


Run pending migrations
$ rails db:migrate
copy


View the status of each migration file
$ rails db:migrate:status
copy


Rollback the last migration
$ rails db:rollback
copy


Fill the current database with data defined in db/seeds.rb
$ rails db:seed
copy

Copied to clipboard