Sails version: 1.0.2
Node version: 8.9.4
NPM version: 6.1.0
DB adapter name: sails-disk
DB adapter version: version that ships with sails 1.0.2
Operating system: Windows 8.1 Enterprise
Howdy,
I've started to use Sails v1 for new projects after using v0.12 for many previous projects. In v0.12, I set a migration strategy I wanted to use for my models in config/models.js.
/**
* Default model settings
* (sails.config.models)
*/
module.exports.models = {
migrate: 'drop',
}
For a given model, I could set a different migration strategy in that model file (eg. api/models/Kitten.js) that would override what was in config/models.js.
/**
* Kitten.js
*
* @description :: A model definition. Represents a database table/collection/etc.
* @docs :: https://sailsjs.com/docs/concepts/models-and-orm/models
*/
module.exports = {
migrate: 'safe',
attributes: {
}
}
When the server lifted, it would honor this model-specific migration strategy, and leave my kittens data intact.
Is this no longer the default behavior in v1.x? I do not see this on the list of breaking changes when upgrading to v1.
Steps to reproduce (or see this repo):
- Generate a new app:
sails generate new testapp1
- Create a kitten model:
sails generate model kitten
- Create a puppy model:
sails generate model puppy
- Set
migrate: 'drop' in config/models.js
- Start sails with
node app.js
- Hit
http://localhost:1337/kitten/create a couple times to generate some kittens.
- Shut down sails
- Add
migrate: 'safe to api/models/Kitten.js
- Start sails with
node app.js
- Go to
http://localhost:1337/kitten... we've lost all the kittens.
Sails version: 1.0.2
Node version: 8.9.4
NPM version: 6.1.0
DB adapter name: sails-disk
DB adapter version: version that ships with sails 1.0.2
Operating system: Windows 8.1 Enterprise
Howdy,
I've started to use Sails v1 for new projects after using v0.12 for many previous projects. In v0.12, I set a migration strategy I wanted to use for my models in
config/models.js.For a given model, I could set a different migration strategy in that model file (eg.
api/models/Kitten.js) that would override what was inconfig/models.js.When the server lifted, it would honor this model-specific migration strategy, and leave my kittens data intact.
Is this no longer the default behavior in v1.x? I do not see this on the list of breaking changes when upgrading to v1.
Steps to reproduce (or see this repo):
sails generate new testapp1sails generate model kittensails generate model puppymigrate: 'drop'inconfig/models.jsnode app.jshttp://localhost:1337/kitten/createa couple times to generate some kittens.migrate: 'safetoapi/models/Kitten.jsnode app.jshttp://localhost:1337/kitten... we've lost all the kittens.