9

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

Travis Webb
  • 14,688
  • 7
  • 55
  • 109
Sahan
  • 1,422
  • 2
  • 18
  • 33

1 Answers1

12

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.

  1. 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.

  1. 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

Travis Webb
  • 14,688
  • 7
  • 55
  • 109
  • So if I use one of these ways n sails V0.10.5 I do not have to ever worry about data loss from SailsJS restart in production mode ? – Sahan May 02 '15 at 10:42
  • I'm trying this now https://github.com/building5/sails-db-migrate,, I just created a new API and now I'm trying to use this migrate tool to build the table for the new API. It does not work ?? Any thoughts ? – Sahan May 02 '15 at 11:31