I'm currently using postgresql
for a database.
I come from more of a rails
background where we create a migration and then run rake db:migrate
to migrate the database.
How can I do something similar in sails.js
?
Do I need to?
With an unmodified config/models.js
file each time you sails lift
it will prompt you for one of 3 possible options, detailed in the docs here:
safe
-- No migrations are runalter
-- Sails will attempt to migrate the data as intelligently as possibledrop
-- Sails will drop the database and run all of the migrations.
Equivalent to rake db: drop db:migrate
It's recommended that you only use safe
in production, and run you migrations either by hand, or using one of the following modules (non-exhaustive list):
In development however you're generally safe to modify your config/models.js
file to set the value of the migrate
attribute to the alter
setting.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With