{"action":"created","issue":{"url":"https://api.github.com/repos/ForestAdmin/lumber/issues/48","repository_url":"https://api.github.com/repos/ForestAdmin/lumber","labels_url":"https://api.github.com/repos/ForestAdmin/lumber/issues/48/labels{/name}","comments_url":"https://api.github.com/repos/ForestAdmin/lumber/issues/48/comments","events_url":"https://api.github.com/repos/ForestAdmin/lumber/issues/48/events","html_url":"https://github.com/ForestAdmin/lumber/issues/48","id":195528492,"number":48,"title":"Bad relationship","user":{"login":"ewiggin","id":657517,"avatar_url":"https://avatars.githubusercontent.com/u/657517?v=3","gravatar_id":"","url":"https://api.github.com/users/ewiggin","html_url":"https://github.com/ewiggin","followers_url":"https://api.github.com/users/ewiggin/followers","following_url":"https://api.github.com/users/ewiggin/following{/other_user}","gists_url":"https://api.github.com/users/ewiggin/gists{/gist_id}","starred_url":"https://api.github.com/users/ewiggin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ewiggin/subscriptions","organizations_url":"https://api.github.com/users/ewiggin/orgs","repos_url":"https://api.github.com/users/ewiggin/repos","events_url":"https://api.github.com/users/ewiggin/events{/privacy}","received_events_url":"https://api.github.com/users/ewiggin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-14T13:18:45Z","updated_at":"2016-12-15T02:12:51Z","closed_at":null,"body":"My project build over Laravel 5.1 and the Database Shema. I have a trouble with the field name of relationships.\r\n\r\nI have the next code:\r\n\r\nOrganismos **hasMany** Programas and Programas **belongsTo** Organismos\r\n\r\n**Organismos**\r\n\r\n```\r\nmodule.exports = (sequelize, DataTypes) => {\r\n  let models = sequelize.models;\r\n\r\n  var Model = sequelize.define('organismos', {\r\n    title: {\r\n      type: DataTypes.STRING,\r\n    },\r\n    disabled: {\r\n      type: DataTypes.INTEGER,\r\n    },\r\n  }, {\r\n    classMethods: {\r\n      associate: () => {\r\n        // hasMany relationships\r\n        Model.hasMany(models.programas);\r\n      }\r\n    },\r\n    tableName: 'organismos',\r\n    \r\n    timestamps: false,\r\n  });\r\n\r\n  return Model;\r\n};\r\n```\r\n\r\n**Porgramas**\r\n```\r\nmodule.exports = (sequelize, DataTypes) => {\r\n  let models = sequelize.models;\r\n\r\n  var Model = sequelize.define('programas', {\r\n    organismo_id: {\r\n      type: DataTypes.INTEGER,\r\n    },\r\n    title: {\r\n      type: DataTypes.STRING,\r\n    },\r\n  }, {\r\n    classMethods: {\r\n      associate: () => {\r\n        // hasMany relationships\r\n        Model.hasMany(models.ejes);\r\n\r\n        // BelongsTo relationships\r\n        Model.belongsTo(models.organismos, {\r\n          foreignKey: 'organismo_id',\r\n        });\r\n      }\r\n    },\r\n    tableName: 'programas',\r\n    underscored: true,\r\n    timestamps: false,\r\n  });\r\n\r\n  return Model;\r\n};\r\n```\r\n\r\nI write the foreign key is *organismo_id* but the lumber get the next error: \r\n`{\"errors\":[{\"detail\":\"ER_BAD_FIELD_ERROR: Unknown column 'organismoId' in 'field list'\"}]}`\r\n\r\nCan't I change this?\r\n"},"comment":{"url":"https://api.github.com/repos/ForestAdmin/lumber/issues/comments/267217079","html_url":"https://github.com/ForestAdmin/lumber/issues/48#issuecomment-267217079","issue_url":"https://api.github.com/repos/ForestAdmin/lumber/issues/48","id":267217079,"user":{"login":"SeyZ","id":519129,"avatar_url":"https://avatars.githubusercontent.com/u/519129?v=3","gravatar_id":"","url":"https://api.github.com/users/SeyZ","html_url":"https://github.com/SeyZ","followers_url":"https://api.github.com/users/SeyZ/followers","following_url":"https://api.github.com/users/SeyZ/following{/other_user}","gists_url":"https://api.github.com/users/SeyZ/gists{/gist_id}","starred_url":"https://api.github.com/users/SeyZ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SeyZ/subscriptions","organizations_url":"https://api.github.com/users/SeyZ/orgs","repos_url":"https://api.github.com/users/SeyZ/repos","events_url":"https://api.github.com/users/SeyZ/events{/privacy}","received_events_url":"https://api.github.com/users/SeyZ/received_events","type":"User","site_admin":false},"created_at":"2016-12-15T02:12:51Z","updated_at":"2016-12-15T02:12:51Z","body":"Hey @ewiggin !\r\n\r\nCan you try to add also the foreignKey on the hasMany relationships? Like:\r\n\r\n```\r\n Model.hasMany(models.programas, {\r\n   foreignKey: 'organismo_id'\r\n });\r\n```\r\n\r\nDoes it work?"}}
{"actor":{"display_login":"SeyZ"}}