{"action":"opened","issue":{"url":"https://api.github.com/repos/KSDaemon/sails-hook-sequelize/issues/52","repository_url":"https://api.github.com/repos/KSDaemon/sails-hook-sequelize","labels_url":"https://api.github.com/repos/KSDaemon/sails-hook-sequelize/issues/52/labels{/name}","comments_url":"https://api.github.com/repos/KSDaemon/sails-hook-sequelize/issues/52/comments","events_url":"https://api.github.com/repos/KSDaemon/sails-hook-sequelize/issues/52/events","html_url":"https://github.com/KSDaemon/sails-hook-sequelize/issues/52","id":311977462,"number":52,"title":"SailsJS v1 - Using custom datastore","user":{"login":"sgates3414","id":30472144,"avatar_url":"https://avatars0.githubusercontent.com/u/30472144?v=4","gravatar_id":"","url":"https://api.github.com/users/sgates3414","html_url":"https://github.com/sgates3414","followers_url":"https://api.github.com/users/sgates3414/followers","following_url":"https://api.github.com/users/sgates3414/following{/other_user}","gists_url":"https://api.github.com/users/sgates3414/gists{/gist_id}","starred_url":"https://api.github.com/users/sgates3414/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgates3414/subscriptions","organizations_url":"https://api.github.com/users/sgates3414/orgs","repos_url":"https://api.github.com/users/sgates3414/repos","events_url":"https://api.github.com/users/sgates3414/events{/privacy}","received_events_url":"https://api.github.com/users/sgates3414/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-06T13:33:21Z","updated_at":"2018-04-06T13:33:21Z","closed_at":null,"author_association":"NONE","body":"I am having some issues with Sails v1 getting any datastore other than 'default' to function.\r\n\r\nI have configured config\\datastores.js as follows:\r\n\r\n```\r\nmodule.exports.datastores = {\r\n\r\n  default: {\r\n\r\n    user: 'user',\r\n    password: 'pass',\r\n    database: 'db',\r\n    dialect: 'mssql',\r\n    options: {\r\n      dialect: 'mssql',\r\n      host   : 'host.domain.com',\r\n      port   : 1433,\r\n      logging: console.log        // or specify sails log level to use ('info', 'warn', 'verbose', etc)\r\n    }\r\n  },\r\n\r\n\r\n  test: {\r\n    user: 'user',\r\n    password: 'pass',\r\n    database: 'db2',\r\n    dialect: 'mssql',\r\n    options: {\r\n      dialect: 'mssql',\r\n      host   : 'host2.domain.com',\r\n      port   : 1433,\r\n      logging: console.log        // or specify sails log level to use ('info', 'warn', 'verbose', etc)\r\n    }\r\n  }\r\n\r\n};\r\n```\r\n\r\nI have configured my model as follows:\r\n\r\n```\r\nmodule.exports = {\r\n  attributes: {\r\n    id: {\r\n      type: Sequelize.STRING,\r\n      allowNull: false,\r\n      primaryKey: true,\r\n      field: 'proid'\r\n    },\r\n    name: {\r\n      type: Sequelize.STRING,\r\n      field: 'name'\r\n    }\r\n  },\r\n  options: {\r\n    tableName: 'inwork',\r\n    classMethods: {},\r\n    instanceMethods: {},\r\n    hooks: {},\r\n    scopes: {},\r\n    connection: 'test',    // Can be omitted, so default sails.config.models.connection will be used\r\n    timestamps: false\r\n  }\r\n};\r\n```\r\n\r\nA custom controller action and route is in place, which is working as expected, however the query fails since the default datastore is the only one being used.  Due to the 'connection' option within models, it would appear that we should be able to use custom datastores, I'm just not sure what to change so that I stop reading the default store only, or if this is a bug with the current version."}}
{"actor":{"display_login":"sgates3414"}}