Tuesday 16 May 2017

Sails.js migration - Instantiated Waterline model already has a `datastore` property

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'
    }
  }



via Pratik Mandrekar

No comments:

Post a Comment