{"action":"created","comment":{"url":"https://api.github.com/repos/sequelize/sequelize/pulls/comments/178426446","pull_request_review_id":108487522,"id":178426446,"diff_hunk":"@@ -152,6 +152,44 @@ describe(Support.getTestDialectTeaser('BelongsTo'), () => {\n         });\n       });\n     });\n+\n+    it('supports schemas when defining custom foreign key attribute #9029', function() {\n+      const self = this,\n+        User = this.sequelize.define('UserXYZ', {\n+          uid: {\n+            type: Sequelize.INTEGER,\n+            primaryKey: true,\n+            autoIncrement: true,\n+            allowNull: false\n+          }\n+        }).schema('archive')\n+        , Task = this.sequelize.define('TaskXYZ', {\n+          user_id: {\n+            type: Sequelize.INTEGER,\n+            references: { model: User, key: 'uid' }\n+          }\n+        }).schema('archive');\n+\n+      Task.belongsTo(User, { foreignKey: 'user_id'});\n+\n+      return self.sequelize.dropAllSchemas().then(() => {\n+        return self.sequelize.createSchema('archive');\n+      }).then(() => {\n+        return User.sync({force: true });","path":"test/integration/associations/belongs-to.test.js","position":27,"original_position":27,"commit_id":"f0bd37af7a8b881b12f5e91b51ff6a566592c79a","original_commit_id":"f0bd37af7a8b881b12f5e91b51ff6a566592c79a","user":{"login":"manV","id":4988376,"avatar_url":"https://avatars3.githubusercontent.com/u/4988376?v=4","gravatar_id":"","url":"https://api.github.com/users/manV","html_url":"https://github.com/manV","followers_url":"https://api.github.com/users/manV/followers","following_url":"https://api.github.com/users/manV/following{/other_user}","gists_url":"https://api.github.com/users/manV/gists{/gist_id}","starred_url":"https://api.github.com/users/manV/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manV/subscriptions","organizations_url":"https://api.github.com/users/manV/orgs","repos_url":"https://api.github.com/users/manV/repos","events_url":"https://api.github.com/users/manV/events{/privacy}","received_events_url":"https://api.github.com/users/manV/received_events","type":"User","site_admin":false},"body":"schema is set using .schema() so .sync has to be called on each model separately according to [this](https://github.com/sequelize/sequelize/blob/master/lib/model.js#L1226).","created_at":"2018-03-31T08:11:33Z","updated_at":"2018-03-31T08:11:33Z","html_url":"https://github.com/sequelize/sequelize/pull/9255#discussion_r178426446","pull_request_url":"https://api.github.com/repos/sequelize/sequelize/pulls/9255","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/comments/178426446"},"html":{"href":"https://github.com/sequelize/sequelize/pull/9255#discussion_r178426446"},"pull_request":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/9255"}},"in_reply_to_id":178423707},"pull_request":{"url":"https://api.github.com/repos/sequelize/sequelize/pulls/9255","id":178652002,"html_url":"https://github.com/sequelize/sequelize/pull/9255","diff_url":"https://github.com/sequelize/sequelize/pull/9255.diff","patch_url":"https://github.com/sequelize/sequelize/pull/9255.patch","issue_url":"https://api.github.com/repos/sequelize/sequelize/issues/9255","number":9255,"state":"open","locked":false,"title":"fix(model/init): add schema name to foreign key when generating sql s…","user":{"login":"manV","id":4988376,"avatar_url":"https://avatars3.githubusercontent.com/u/4988376?v=4","gravatar_id":"","url":"https://api.github.com/users/manV","html_url":"https://github.com/manV","followers_url":"https://api.github.com/users/manV/followers","following_url":"https://api.github.com/users/manV/following{/other_user}","gists_url":"https://api.github.com/users/manV/gists{/gist_id}","starred_url":"https://api.github.com/users/manV/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manV/subscriptions","organizations_url":"https://api.github.com/users/manV/orgs","repos_url":"https://api.github.com/users/manV/repos","events_url":"https://api.github.com/users/manV/events{/privacy}","received_events_url":"https://api.github.com/users/manV/received_events","type":"User","site_admin":false},"body":"…tatements (#9029) (#2464)\r\n\r\n<!-- \r\nThanks for wanting to fix something on Sequelize - we already love you long time!\r\nPlease fill in the template below.\r\nIf unsure about something, just do as best as you're able.\r\n\r\nIf your PR only contains changes to documentation, you may skip the template below.\r\n-->\r\n\r\n### Pull Request check-list\r\n\r\n_Please make sure to review and check all of these items:_\r\n\r\n- [x] Does `npm run test` or `npm run test-DIALECT` pass with this change (including linting)?\r\n- [x] Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?\r\n- [x] Have you added new tests to prevent regressions?\r\n- [ ] Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?\r\n- [x] Did you follow the commit message conventions explained in [CONTRIBUTING.md](../CONTRIBUTING.md)?\r\n\r\n<!-- NOTE: these things are not required to open a PR and can be done afterwards / while the PR is open. -->\r\n\r\n### Description of change\r\nFixes #9029 and #2464. Using getTableName() so that schema is added to foreign key reference in generated sql statement.\r\n\r\n<!-- Please provide a description of the change here. -->\r\n","created_at":"2018-03-30T23:24:18Z","updated_at":"2018-03-31T08:11:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bf5d61826e642420be7ff13d8281078026e92aef","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/sequelize/sequelize/pulls/9255/commits","review_comments_url":"https://api.github.com/repos/sequelize/sequelize/pulls/9255/comments","review_comment_url":"https://api.github.com/repos/sequelize/sequelize/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sequelize/sequelize/issues/9255/comments","statuses_url":"https://api.github.com/repos/sequelize/sequelize/statuses/f0bd37af7a8b881b12f5e91b51ff6a566592c79a","head":{"label":"manV:fix-9029","ref":"fix-9029","sha":"f0bd37af7a8b881b12f5e91b51ff6a566592c79a","user":{"login":"manV","id":4988376,"avatar_url":"https://avatars3.githubusercontent.com/u/4988376?v=4","gravatar_id":"","url":"https://api.github.com/users/manV","html_url":"https://github.com/manV","followers_url":"https://api.github.com/users/manV/followers","following_url":"https://api.github.com/users/manV/following{/other_user}","gists_url":"https://api.github.com/users/manV/gists{/gist_id}","starred_url":"https://api.github.com/users/manV/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manV/subscriptions","organizations_url":"https://api.github.com/users/manV/orgs","repos_url":"https://api.github.com/users/manV/repos","events_url":"https://api.github.com/users/manV/events{/privacy}","received_events_url":"https://api.github.com/users/manV/received_events","type":"User","site_admin":false},"repo":{"id":127025969,"name":"sequelize","full_name":"manV/sequelize","owner":{"login":"manV","id":4988376,"avatar_url":"https://avatars3.githubusercontent.com/u/4988376?v=4","gravatar_id":"","url":"https://api.github.com/users/manV","html_url":"https://github.com/manV","followers_url":"https://api.github.com/users/manV/followers","following_url":"https://api.github.com/users/manV/following{/other_user}","gists_url":"https://api.github.com/users/manV/gists{/gist_id}","starred_url":"https://api.github.com/users/manV/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manV/subscriptions","organizations_url":"https://api.github.com/users/manV/orgs","repos_url":"https://api.github.com/users/manV/repos","events_url":"https://api.github.com/users/manV/events{/privacy}","received_events_url":"https://api.github.com/users/manV/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/manV/sequelize","description":"An easy-to-use multi SQL dialect ORM for Node.js","fork":true,"url":"https://api.github.com/repos/manV/sequelize","forks_url":"https://api.github.com/repos/manV/sequelize/forks","keys_url":"https://api.github.com/repos/manV/sequelize/keys{/key_id}","collaborators_url":"https://api.github.com/repos/manV/sequelize/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/manV/sequelize/teams","hooks_url":"https://api.github.com/repos/manV/sequelize/hooks","issue_events_url":"https://api.github.com/repos/manV/sequelize/issues/events{/number}","events_url":"https://api.github.com/repos/manV/sequelize/events","assignees_url":"https://api.github.com/repos/manV/sequelize/assignees{/user}","branches_url":"https://api.github.com/repos/manV/sequelize/branches{/branch}","tags_url":"https://api.github.com/repos/manV/sequelize/tags","blobs_url":"https://api.github.com/repos/manV/sequelize/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/manV/sequelize/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/manV/sequelize/git/refs{/sha}","trees_url":"https://api.github.com/repos/manV/sequelize/git/trees{/sha}","statuses_url":"https://api.github.com/repos/manV/sequelize/statuses/{sha}","languages_url":"https://api.github.com/repos/manV/sequelize/languages","stargazers_url":"https://api.github.com/repos/manV/sequelize/stargazers","contributors_url":"https://api.github.com/repos/manV/sequelize/contributors","subscribers_url":"https://api.github.com/repos/manV/sequelize/subscribers","subscription_url":"https://api.github.com/repos/manV/sequelize/subscription","commits_url":"https://api.github.com/repos/manV/sequelize/commits{/sha}","git_commits_url":"https://api.github.com/repos/manV/sequelize/git/commits{/sha}","comments_url":"https://api.github.com/repos/manV/sequelize/comments{/number}","issue_comment_url":"https://api.github.com/repos/manV/sequelize/issues/comments{/number}","contents_url":"https://api.github.com/repos/manV/sequelize/contents/{+path}","compare_url":"https://api.github.com/repos/manV/sequelize/compare/{base}...{head}","merges_url":"https://api.github.com/repos/manV/sequelize/merges","archive_url":"https://api.github.com/repos/manV/sequelize/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/manV/sequelize/downloads","issues_url":"https://api.github.com/repos/manV/sequelize/issues{/number}","pulls_url":"https://api.github.com/repos/manV/sequelize/pulls{/number}","milestones_url":"https://api.github.com/repos/manV/sequelize/milestones{/number}","notifications_url":"https://api.github.com/repos/manV/sequelize/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/manV/sequelize/labels{/name}","releases_url":"https://api.github.com/repos/manV/sequelize/releases{/id}","deployments_url":"https://api.github.com/repos/manV/sequelize/deployments","created_at":"2018-03-27T17:57:59Z","updated_at":"2018-03-30T22:41:02Z","pushed_at":"2018-03-30T23:53:45Z","git_url":"git://github.com/manV/sequelize.git","ssh_url":"git@github.com:manV/sequelize.git","clone_url":"https://github.com/manV/sequelize.git","svn_url":"https://github.com/manV/sequelize","homepage":"http://docs.sequelizejs.com","size":22114,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"sequelize:master","ref":"master","sha":"6dcc3e7d58af0a33c776d07a662afe3b94abfce0","user":{"login":"sequelize","id":3591786,"avatar_url":"https://avatars0.githubusercontent.com/u/3591786?v=4","gravatar_id":"","url":"https://api.github.com/users/sequelize","html_url":"https://github.com/sequelize","followers_url":"https://api.github.com/users/sequelize/followers","following_url":"https://api.github.com/users/sequelize/following{/other_user}","gists_url":"https://api.github.com/users/sequelize/gists{/gist_id}","starred_url":"https://api.github.com/users/sequelize/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sequelize/subscriptions","organizations_url":"https://api.github.com/users/sequelize/orgs","repos_url":"https://api.github.com/users/sequelize/repos","events_url":"https://api.github.com/users/sequelize/events{/privacy}","received_events_url":"https://api.github.com/users/sequelize/received_events","type":"Organization","site_admin":false},"repo":{"id":790359,"name":"sequelize","full_name":"sequelize/sequelize","owner":{"login":"sequelize","id":3591786,"avatar_url":"https://avatars0.githubusercontent.com/u/3591786?v=4","gravatar_id":"","url":"https://api.github.com/users/sequelize","html_url":"https://github.com/sequelize","followers_url":"https://api.github.com/users/sequelize/followers","following_url":"https://api.github.com/users/sequelize/following{/other_user}","gists_url":"https://api.github.com/users/sequelize/gists{/gist_id}","starred_url":"https://api.github.com/users/sequelize/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sequelize/subscriptions","organizations_url":"https://api.github.com/users/sequelize/orgs","repos_url":"https://api.github.com/users/sequelize/repos","events_url":"https://api.github.com/users/sequelize/events{/privacy}","received_events_url":"https://api.github.com/users/sequelize/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sequelize/sequelize","description":"An easy-to-use multi SQL dialect ORM for Node.js","fork":false,"url":"https://api.github.com/repos/sequelize/sequelize","forks_url":"https://api.github.com/repos/sequelize/sequelize/forks","keys_url":"https://api.github.com/repos/sequelize/sequelize/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sequelize/sequelize/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sequelize/sequelize/teams","hooks_url":"https://api.github.com/repos/sequelize/sequelize/hooks","issue_events_url":"https://api.github.com/repos/sequelize/sequelize/issues/events{/number}","events_url":"https://api.github.com/repos/sequelize/sequelize/events","assignees_url":"https://api.github.com/repos/sequelize/sequelize/assignees{/user}","branches_url":"https://api.github.com/repos/sequelize/sequelize/branches{/branch}","tags_url":"https://api.github.com/repos/sequelize/sequelize/tags","blobs_url":"https://api.github.com/repos/sequelize/sequelize/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sequelize/sequelize/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sequelize/sequelize/git/refs{/sha}","trees_url":"https://api.github.com/repos/sequelize/sequelize/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sequelize/sequelize/statuses/{sha}","languages_url":"https://api.github.com/repos/sequelize/sequelize/languages","stargazers_url":"https://api.github.com/repos/sequelize/sequelize/stargazers","contributors_url":"https://api.github.com/repos/sequelize/sequelize/contributors","subscribers_url":"https://api.github.com/repos/sequelize/sequelize/subscribers","subscription_url":"https://api.github.com/repos/sequelize/sequelize/subscription","commits_url":"https://api.github.com/repos/sequelize/sequelize/commits{/sha}","git_commits_url":"https://api.github.com/repos/sequelize/sequelize/git/commits{/sha}","comments_url":"https://api.github.com/repos/sequelize/sequelize/comments{/number}","issue_comment_url":"https://api.github.com/repos/sequelize/sequelize/issues/comments{/number}","contents_url":"https://api.github.com/repos/sequelize/sequelize/contents/{+path}","compare_url":"https://api.github.com/repos/sequelize/sequelize/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sequelize/sequelize/merges","archive_url":"https://api.github.com/repos/sequelize/sequelize/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sequelize/sequelize/downloads","issues_url":"https://api.github.com/repos/sequelize/sequelize/issues{/number}","pulls_url":"https://api.github.com/repos/sequelize/sequelize/pulls{/number}","milestones_url":"https://api.github.com/repos/sequelize/sequelize/milestones{/number}","notifications_url":"https://api.github.com/repos/sequelize/sequelize/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sequelize/sequelize/labels{/name}","releases_url":"https://api.github.com/repos/sequelize/sequelize/releases{/id}","deployments_url":"https://api.github.com/repos/sequelize/sequelize/deployments","created_at":"2010-07-22T07:11:11Z","updated_at":"2018-03-31T04:54:50Z","pushed_at":"2018-03-30T23:53:47Z","git_url":"git://github.com/sequelize/sequelize.git","ssh_url":"git@github.com:sequelize/sequelize.git","clone_url":"https://github.com/sequelize/sequelize.git","svn_url":"https://github.com/sequelize/sequelize","homepage":"http://docs.sequelizejs.com","size":22131,"stargazers_count":13724,"watchers_count":13724,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2395,"mirror_url":null,"archived":false,"open_issues_count":356,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":2395,"open_issues":356,"watchers":13724,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/9255"},"html":{"href":"https://github.com/sequelize/sequelize/pull/9255"},"issue":{"href":"https://api.github.com/repos/sequelize/sequelize/issues/9255"},"comments":{"href":"https://api.github.com/repos/sequelize/sequelize/issues/9255/comments"},"review_comments":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/9255/comments"},"review_comment":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/9255/commits"},"statuses":{"href":"https://api.github.com/repos/sequelize/sequelize/statuses/f0bd37af7a8b881b12f5e91b51ff6a566592c79a"}},"author_association":"NONE"}}
{"actor":{"display_login":"manV"}}