Angel Aguirre

Rails Database Change


If you're anything like me, you probably often draw a blank when it comes to remembering the command for switching databases in your Ruby on Rails projects. But hey, no sweat, future self (or whoever else is reading this), just hit up "Rails Change Database" in your search bar next time, and with any luck, you'll find what you need.

  • 1. Change DB
  • 2. Seed DB information


And for those who aren't me in the future, well, hope this little tidbit comes in handy for you too. But honestly, I mainly wrote this down as a memo to jog my memory on database switches in Rails projects.

rails db:system:change  --to=postgresql
rails db:system:change --to=sqlite3
rails db:system:change --to=mysql

# Don't forget to setup and migrate
rails db:create
rails db:migrate
rails db:seed
|