Best way to migrate table changes to production sailsjs tables

瘦欲@ 提交于 2019-11-29 15:09:11

问题


I just lost 11,000 records from my database just running the command for sailsjs without the --prod part in it, So I thought I should ask whats the best way to change the tables on production server when the Model.js has been changed ?

Thanks


回答1:


Automated migration should never be done in production. This a common-sense practice that applies to any production system with important data. There are a few solutions available for migrating a sails.js database.

  1. sails-db-migrate: db-migrate integration for sails.js

    db-migrate integration for Sails.js. This is a fairly simple wrapper, which provides grunt tasks for running and creating migrations.

    At Langa we've used sails-db-migrate before with success.

  2. sails-migrations: The missing, migrations arm of the octopus

    sails-migrations provides an easy way to manage database migrations with sails, based on the amazing https://github.com/tgriesser/knex lib. This means you can have fine-grained control over your schema/data transformations between versions.

  3. Sequelize migrations

    Sequelize 2.0.0 introduces a new CLI which is based on gulp and combines sequelize-cli and gulp-sequelize. The CLI ships support for migrations and project bootstrapping. With migrations you can transfer your existing database into another state and vice versa



来源:https://stackoverflow.com/questions/29997983/best-way-to-migrate-table-changes-to-production-sailsjs-tables

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!