将表更改迁移到生产 Sailsjs 表的最佳方法 [英] Best way to migrate table changes to production sailsjs tables

查看:28
本文介绍了将表更改迁移到生产 Sailsjs 表的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚从我的数据库中丢失了 11,000 条记录,只是在没有 --prod 部分的情况下运行了 Sailsjs 的命令,所以我想我应该问当 Model.js改变了吗?

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 ?

谢谢

推荐答案

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

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:sails.js 的 db-migrate 集成

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

用于 Sails.js 的 db-migrate 集成.这是一个相当简单的包装器,它为运行和创建迁移提供了繁重的任务.

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.

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

sails-migrations:缺失的迁移章鱼的手臂

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

sails-migrations 基于令人惊叹的 https://github,提供了一种使用sails 管理数据库迁移的简单方法.com/tgriesser/knex 库.这意味着您可以对版本之间的架构/数据转换进行细粒度控制.

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.

  • Sequelize 迁移

    Sequelize 2.0.0 引入了一个新的 CLI,它基于 gulp,结合了 sequelize-cli 和 gulp-sequelize.CLI 提供对迁移和项目引导的支持.通过迁移,您可以将现有数据库转移到另一个状态,反之亦然

    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

  • 这篇关于将表更改迁移到生产 Sailsjs 表的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆