Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sails.js: Production env + sails-mysql - database tables not created upon lift

In production mode, when lifting a Sails application, the database tables are not created upon lift, while in dev mode, they are. Right now, when deploying, I'm running in dev mode once first so that the tables can be created and then running in prod mode. Is there a way around this?

like image 284
kk415kk Avatar asked Aug 12 '14 03:08

kk415kk


1 Answers

No; this is by design. In the production environment, Sails does not do any migration to ensure that data isn't corrupted or lost when lifting.

From the Sails deployment guide:

Sails sets all your models to migrate:safe when run in production, which means no auto-migrations are run on starting up the app. You can set your database up the following way: Create the database on the server and then run your sails app with migrate:alter locally, but configured to use the production server as your db. This will automatically set things up. In case you can't connect to the server remotely, you'll simply dump your local schema and import it into the database server.

like image 114
sgress454 Avatar answered Sep 28 '22 04:09

sgress454