While migrating to sails 1.0 I'm getting this error when I do a sails lift
-
Error: Consistency violation: Instantiated Waterline model already has a `datastore` property
My config -
// config/datastores.js
module.exports.datastores = {
default : {
mySQL: {
adapter: 'sails-mysql',
url: 'mysql://username@localhost:3306/my_db'
}
}
}
// config/models.js
module.exports.models = {
datastore: 'mySQL',
migrate: 'drop',
attributes: {
// timezone-agnostic ISO 8601 JSON timestamp strings (e.g. '2017-12-30T12:51:10Z')
createdAt: { type: 'string', autoCreatedAt: true, },
updatedAt: { type: 'string', autoUpdatedAt: true, }
}
};
// config/env/development.js
datastores: {
mySQL: {
adapter: 'sails-mysql',
url: 'mysql://username@localhost:3306/my_db'
}
}
In Sails 1.0, the default datastore is simply called
default
, and the best practice is to just configuredefault
with whatever settings you need rather than creating a separately-named datastore likemySQL
, unless you actually need multiple datastores in an app. So try: