Rails: Recreating the Database One-Liner
Handy One-Liner
To recreate the database, type in your terminal:
rake db:drop && rake db:create && rake db:migrate && rake db:seed
Create an alias
You can create an alias for recreating the database:
alias recreate="rake db:drop && rake db:create && rake db:migrate && rake db:seed"
And now for recreating the database, just type: recreate
.
Make your alias permanent
1) Open your ~/.bashrc
file.
vi ~/.bashrc
2) Put your alias inside.
alias recreate="rake db:drop && rake db:create && rake db:migrate && rake db:seed"
3) Restart terminal.
Written by Sebastian Muszyński
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Rails
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#