Rails 6 adds rails db:prepare to create and migrate and seed the database
Rails 6 adds a new task rails db:prepare!
Let’s suppose you cloned a project and that consists of some seed data and BIG schema .
What you would be doing after cloning the project is that you’ll surely be using the following command to complete your database setup right?
- ) rails db:create #to create the database
- ) rails db:migrate #to migrate the tables from schema to database
- ) rails db:seed #to seed the data
Well now you don’t need to run these tasks individually if you’ve switched to rails 6
you just need to run rails db:prepare
This could save you some time.
here’s the commit message from the contributers
I have implemented
rake db:prepare
which creates the database, loads the schema, run the migrations and initializes with the seed data
(use db:reset to also drop the database first). This rake task runs in an idempotent way
Please have a look at the Pull request
Thanks for giving this blog a read
Happy coding!