1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-22 15:22:08 +02:00
tldr/pages/common/rails-db.md
2024-11-04 09:35:01 +05:30

36 lines
694 B
Markdown

# rails db
> Various database-related subcommands for Ruby on Rails.
> More information: <https://guides.rubyonrails.org/active_record_migrations.html>.
- Create databases, load the schema, and initialize with seed data:
`rails db:setup`
- Access the database console:
`rails db`
- Create the databases defined in the current environment:
`rails db:create`
- Destroy the databases defined in the current environment:
`rails db:drop`
- Run pending migrations:
`rails db:migrate`
- View the status of each migration file:
`rails db:migrate:status`
- Rollback the last migration:
`rails db:rollback`
- Fill the current database with data defined in `db/seeds.rb`:
`rails db:seed`