[RUBY] [Rails] rails db command summary

From rails5.0, it seems that both rake command and rails command can be used

Create / delete database (defined by database.yml)

#create
$ rails db:create

#delete
$ rails db:drop

Drop all tables and regenerate the tables

# db/Regenerated based on schema
$ rails db:reset

# db/Regenerate based on migrate file
$ rails db:migrate:status

Make the previous instruction in the migration file missing

#Make the previous order absent
$ rails db:rollback

#Make the previous two commands not continuous
$ rails db:rollback STEP=2

Reflect test data in database

#Created based on seed file
$ rails db:seed

Initialize the development environment at once

# create / schema:load /Execute the seed command in order
$ rails db:setup

Reference article

https://qiita.com/parsetree/items/e9b08c6b11f762b949de

Recommended Posts

[Rails] rails db command summary
rails db: 〇〇 Summary
[Rails] Migration command summary
Heroku command summary
Docker command summary
Rails 6.0 Routing Summary
[Docker] Command summary
[Rails] devise-related routing summary
rails error resolution summary
docker command personal summary
rails test db only drop
rails new application launch command
Error in rails db: migrate
Rails Tutorial (4th Edition) Summary
Ruby on Rails validation summary
Introduction to RSpec-Everyday Rails Summary-
Ruby on Rails Overview (Beginner Summary)
[Rails Struggle/Rails Tutorial] Summary of Rails Tutorial Chapter 2
Summary of rails validation (for myself)
[rails] How to display db information
Ruby on Rails variable, constant summary
[Personal note] Rails DB index consideration
[Rails] DB design for EC site
rails tutorial chapter 10 summary (for self-learning)
[Rails] Summary of complicated routing configurations
Summary
Rails DB PostgreSQL changed to MySQL
[Rails] Modify migrate file (rails db: rollback)
[Rails] Reflection to db using seeds.rb
[Rails] AWS deployment error encounter summary
Summary of basic migration knowledge rails db: rollback and column addition / deletion
Rails Tutorial 6th Edition Learning Summary Chapter 10
Rails Tutorial 6th Edition Learning Summary Chapter 7
Rails Tutorial 6th Edition Learning Summary Chapter 4
[Rails] Modify migrate file (rails db: rollback STEP =)
Rails Tutorial 6th Edition Learning Summary Chapter 6
[Ruby on Rails] model, controller terminal command
Ruby on Rails model creation / deletion command
[Rails Struggle/Rails Tutorial] Summary of Heroku commands
Rails Tutorial 6th Edition Learning Summary Chapter 5
Rails Tutorial 6th Edition Learning Summary Chapter 2
Ruby on Rails controller create / delete command
Ruby on Rails application new creation command
[Rails] Store only checked items in DB
Rails: A little summary about data types
Rails Tutorial 6th Edition Learning Summary Chapter 3
[Rails] Method summary for conversion / verification / search
[heroku] run rails db: migrate doesn't work
Rails Tutorial 6th Edition Learning Summary Chapter 8