{"action":"created","comment":{"url":"https://api.github.com/repos/sequelize/sequelize/pulls/comments/33897229","id":33897229,"diff_hunk":"@@ -1641,6 +1641,10 @@ Model.prototype.findOrCreate = function(options) {\n     );\n   }\n \n+  if (this.sequelize.constructor.cls) {\n+    options.transaction = this.sequelize.constructor.cls.get('transaction');","path":"lib/model.js","position":5,"original_position":5,"commit_id":"feebfae88dc9ff9cd84a02a857e9278cbd9dc3b5","original_commit_id":"feebfae88dc9ff9cd84a02a857e9278cbd9dc3b5","user":{"login":"mickhansen","id":699049,"avatar_url":"https://avatars.githubusercontent.com/u/699049?v=3","gravatar_id":"","url":"https://api.github.com/users/mickhansen","html_url":"https://github.com/mickhansen","followers_url":"https://api.github.com/users/mickhansen/followers","following_url":"https://api.github.com/users/mickhansen/following{/other_user}","gists_url":"https://api.github.com/users/mickhansen/gists{/gist_id}","starred_url":"https://api.github.com/users/mickhansen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mickhansen/subscriptions","organizations_url":"https://api.github.com/users/mickhansen/orgs","repos_url":"https://api.github.com/users/mickhansen/repos","events_url":"https://api.github.com/users/mickhansen/events{/privacy}","received_events_url":"https://api.github.com/users/mickhansen/received_events","type":"User","site_admin":false},"body":"Hmm although it's probably not possible to access the Sequelize class at this point so your method is probably the only way.","created_at":"2015-07-05T18:11:13Z","updated_at":"2015-07-05T18:11:13Z","html_url":"https://github.com/sequelize/sequelize/pull/4062#discussion_r33897229","pull_request_url":"https://api.github.com/repos/sequelize/sequelize/pulls/4062","_links":{"self":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/comments/33897229"},"html":{"href":"https://github.com/sequelize/sequelize/pull/4062#discussion_r33897229"},"pull_request":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/4062"}}},"pull_request":{"url":"https://api.github.com/repos/sequelize/sequelize/pulls/4062","id":39201497,"html_url":"https://github.com/sequelize/sequelize/pull/4062","diff_url":"https://github.com/sequelize/sequelize/pull/4062.diff","patch_url":"https://github.com/sequelize/sequelize/pull/4062.patch","issue_url":"https://api.github.com/repos/sequelize/sequelize/issues/4062","number":4062,"state":"open","locked":false,"title":"FindOrCreate with CLS not using stored transaction","user":{"login":"gutobortolozzo","id":6811769,"avatar_url":"https://avatars.githubusercontent.com/u/6811769?v=3","gravatar_id":"","url":"https://api.github.com/users/gutobortolozzo","html_url":"https://github.com/gutobortolozzo","followers_url":"https://api.github.com/users/gutobortolozzo/followers","following_url":"https://api.github.com/users/gutobortolozzo/following{/other_user}","gists_url":"https://api.github.com/users/gutobortolozzo/gists{/gist_id}","starred_url":"https://api.github.com/users/gutobortolozzo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gutobortolozzo/subscriptions","organizations_url":"https://api.github.com/users/gutobortolozzo/orgs","repos_url":"https://api.github.com/users/gutobortolozzo/repos","events_url":"https://api.github.com/users/gutobortolozzo/events{/privacy}","received_events_url":"https://api.github.com/users/gutobortolozzo/received_events","type":"User","site_admin":false},"body":"https://github.com/sequelize/sequelize/issues/4039","created_at":"2015-07-04T02:36:10Z","updated_at":"2015-07-05T18:11:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1a52a0d378e25dc463acc793d512cd2c8b162b93","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sequelize/sequelize/pulls/4062/commits","review_comments_url":"https://api.github.com/repos/sequelize/sequelize/pulls/4062/comments","review_comment_url":"https://api.github.com/repos/sequelize/sequelize/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sequelize/sequelize/issues/4062/comments","statuses_url":"https://api.github.com/repos/sequelize/sequelize/statuses/feebfae88dc9ff9cd84a02a857e9278cbd9dc3b5","head":{"label":"gutobortolozzo:clsFindOrCreate","ref":"clsFindOrCreate","sha":"feebfae88dc9ff9cd84a02a857e9278cbd9dc3b5","user":{"login":"gutobortolozzo","id":6811769,"avatar_url":"https://avatars.githubusercontent.com/u/6811769?v=3","gravatar_id":"","url":"https://api.github.com/users/gutobortolozzo","html_url":"https://github.com/gutobortolozzo","followers_url":"https://api.github.com/users/gutobortolozzo/followers","following_url":"https://api.github.com/users/gutobortolozzo/following{/other_user}","gists_url":"https://api.github.com/users/gutobortolozzo/gists{/gist_id}","starred_url":"https://api.github.com/users/gutobortolozzo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gutobortolozzo/subscriptions","organizations_url":"https://api.github.com/users/gutobortolozzo/orgs","repos_url":"https://api.github.com/users/gutobortolozzo/repos","events_url":"https://api.github.com/users/gutobortolozzo/events{/privacy}","received_events_url":"https://api.github.com/users/gutobortolozzo/received_events","type":"User","site_admin":false},"repo":{"id":38405362,"name":"sequelize","full_name":"gutobortolozzo/sequelize","owner":{"login":"gutobortolozzo","id":6811769,"avatar_url":"https://avatars.githubusercontent.com/u/6811769?v=3","gravatar_id":"","url":"https://api.github.com/users/gutobortolozzo","html_url":"https://github.com/gutobortolozzo","followers_url":"https://api.github.com/users/gutobortolozzo/followers","following_url":"https://api.github.com/users/gutobortolozzo/following{/other_user}","gists_url":"https://api.github.com/users/gutobortolozzo/gists{/gist_id}","starred_url":"https://api.github.com/users/gutobortolozzo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gutobortolozzo/subscriptions","organizations_url":"https://api.github.com/users/gutobortolozzo/orgs","repos_url":"https://api.github.com/users/gutobortolozzo/repos","events_url":"https://api.github.com/users/gutobortolozzo/events{/privacy}","received_events_url":"https://api.github.com/users/gutobortolozzo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gutobortolozzo/sequelize","description":"Sequelize is an easy-to-use multi sql dialect ORM for Node.js & io.js. It currently supports MySQL, MariaDB, SQLite, PostgreSQL and MSSQL.","fork":true,"url":"https://api.github.com/repos/gutobortolozzo/sequelize","forks_url":"https://api.github.com/repos/gutobortolozzo/sequelize/forks","keys_url":"https://api.github.com/repos/gutobortolozzo/sequelize/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gutobortolozzo/sequelize/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gutobortolozzo/sequelize/teams","hooks_url":"https://api.github.com/repos/gutobortolozzo/sequelize/hooks","issue_events_url":"https://api.github.com/repos/gutobortolozzo/sequelize/issues/events{/number}","events_url":"https://api.github.com/repos/gutobortolozzo/sequelize/events","assignees_url":"https://api.github.com/repos/gutobortolozzo/sequelize/assignees{/user}","branches_url":"https://api.github.com/repos/gutobortolozzo/sequelize/branches{/branch}","tags_url":"https://api.github.com/repos/gutobortolozzo/sequelize/tags","blobs_url":"https://api.github.com/repos/gutobortolozzo/sequelize/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gutobortolozzo/sequelize/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gutobortolozzo/sequelize/git/refs{/sha}","trees_url":"https://api.github.com/repos/gutobortolozzo/sequelize/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gutobortolozzo/sequelize/statuses/{sha}","languages_url":"https://api.github.com/repos/gutobortolozzo/sequelize/languages","stargazers_url":"https://api.github.com/repos/gutobortolozzo/sequelize/stargazers","contributors_url":"https://api.github.com/repos/gutobortolozzo/sequelize/contributors","subscribers_url":"https://api.github.com/repos/gutobortolozzo/sequelize/subscribers","subscription_url":"https://api.github.com/repos/gutobortolozzo/sequelize/subscription","commits_url":"https://api.github.com/repos/gutobortolozzo/sequelize/commits{/sha}","git_commits_url":"https://api.github.com/repos/gutobortolozzo/sequelize/git/commits{/sha}","comments_url":"https://api.github.com/repos/gutobortolozzo/sequelize/comments{/number}","issue_comment_url":"https://api.github.com/repos/gutobortolozzo/sequelize/issues/comments{/number}","contents_url":"https://api.github.com/repos/gutobortolozzo/sequelize/contents/{+path}","compare_url":"https://api.github.com/repos/gutobortolozzo/sequelize/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gutobortolozzo/sequelize/merges","archive_url":"https://api.github.com/repos/gutobortolozzo/sequelize/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gutobortolozzo/sequelize/downloads","issues_url":"https://api.github.com/repos/gutobortolozzo/sequelize/issues{/number}","pulls_url":"https://api.github.com/repos/gutobortolozzo/sequelize/pulls{/number}","milestones_url":"https://api.github.com/repos/gutobortolozzo/sequelize/milestones{/number}","notifications_url":"https://api.github.com/repos/gutobortolozzo/sequelize/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gutobortolozzo/sequelize/labels{/name}","releases_url":"https://api.github.com/repos/gutobortolozzo/sequelize/releases{/id}","created_at":"2015-07-02T01:57:25Z","updated_at":"2015-07-02T01:57:28Z","pushed_at":"2015-07-05T17:58:10Z","git_url":"git://github.com/gutobortolozzo/sequelize.git","ssh_url":"git@github.com:gutobortolozzo/sequelize.git","clone_url":"https://github.com/gutobortolozzo/sequelize.git","svn_url":"https://github.com/gutobortolozzo/sequelize","homepage":"http://sequelizejs.com","size":14996,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"sequelize:master","ref":"master","sha":"e8eae768213d74d2d71c803580856f8898ea9500","user":{"login":"sequelize","id":3591786,"avatar_url":"https://avatars.githubusercontent.com/u/3591786?v=3","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://avatars.githubusercontent.com/u/3591786?v=3","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":"Sequelize is an easy-to-use multi sql dialect ORM for Node.js & io.js. It currently supports MySQL, MariaDB, SQLite, PostgreSQL and MSSQL.","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}","created_at":"2010-07-22T07:11:11Z","updated_at":"2015-07-05T01:20:44Z","pushed_at":"2015-07-05T17:58:13Z","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://sequelizejs.com","size":58207,"stargazers_count":4055,"watchers_count":4055,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":917,"mirror_url":null,"open_issues_count":440,"forks":917,"open_issues":440,"watchers":4055,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/4062"},"html":{"href":"https://github.com/sequelize/sequelize/pull/4062"},"issue":{"href":"https://api.github.com/repos/sequelize/sequelize/issues/4062"},"comments":{"href":"https://api.github.com/repos/sequelize/sequelize/issues/4062/comments"},"review_comments":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/4062/comments"},"review_comment":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sequelize/sequelize/pulls/4062/commits"},"statuses":{"href":"https://api.github.com/repos/sequelize/sequelize/statuses/feebfae88dc9ff9cd84a02a857e9278cbd9dc3b5"}}}}