将 table 更改迁移到生产 sailsjs tables 的最佳方式

Best way to migrate table changes to production sailsjs tables

我刚刚从我的数据库中丢失了 11,000 条记录 运行 sailsjs 的命令没有 --prod 部分,所以我想我应该问什么是更改生产服务器上的表的最佳方法Model.js 已更改 ?

谢谢

绝不能在生产环境中进行自动迁移。这是适用于任何具有重要数据的生产系统的常识性做法。有一些解决方案可用于迁移 sails.js 数据库。

  1. sails-db-migrate:sails.js

    的数据库迁移集成

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

    Langa 我们之前成功使用过 sails-db-migrate。

  2. sails-migrations: 章鱼失踪、迁徙的手臂

    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