简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM