{"action":"created","issue":{"url":"https://api.github.com/repos/bookshelf/bookshelf/issues/838","repository_url":"https://api.github.com/repos/bookshelf/bookshelf","labels_url":"https://api.github.com/repos/bookshelf/bookshelf/issues/838/labels{/name}","comments_url":"https://api.github.com/repos/bookshelf/bookshelf/issues/838/comments","events_url":"https://api.github.com/repos/bookshelf/bookshelf/issues/838/events","html_url":"https://github.com/bookshelf/bookshelf/issues/838","id":95782425,"number":838,"title":"Event is called before SQL transaction is committed","user":{"login":"olalonde","id":416585,"avatar_url":"https://avatars3.githubusercontent.com/u/416585?v=4","gravatar_id":"","url":"https://api.github.com/users/olalonde","html_url":"https://github.com/olalonde","followers_url":"https://api.github.com/users/olalonde/followers","following_url":"https://api.github.com/users/olalonde/following{/other_user}","gists_url":"https://api.github.com/users/olalonde/gists{/gist_id}","starred_url":"https://api.github.com/users/olalonde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/olalonde/subscriptions","organizations_url":"https://api.github.com/users/olalonde/orgs","repos_url":"https://api.github.com/users/olalonde/repos","events_url":"https://api.github.com/users/olalonde/events{/privacy}","received_events_url":"https://api.github.com/users/olalonde/received_events","type":"User","site_admin":false},"labels":[{"id":30805516,"url":"https://api.github.com/repos/bookshelf/bookshelf/labels/feature%20request","name":"feature request","color":"84b6eb","default":false},{"id":124002273,"url":"https://api.github.com/repos/bookshelf/bookshelf/labels/PR%20please","name":"PR please","color":"0052cc","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2015-07-18T03:07:12Z","updated_at":"2017-07-19T17:19:40Z","closed_at":"2017-07-19T17:19:40Z","body":"The \"created\" event seems to be called before the transaction has committed. Which means that if I want to insert a new row that references the newly created one in the event handler, I get a foreign key error unless I do it within the transaction.\n\nIs this a bug or a feature? What's the best way to handle this? Should I just pass the transaction around? Is it OK to commit the transaction inside the event handler and if so, how to do it (`options.transacting.commit()` ?)\n"},"comment":{"url":"https://api.github.com/repos/bookshelf/bookshelf/issues/comments/316456688","html_url":"https://github.com/bookshelf/bookshelf/issues/838#issuecomment-316456688","issue_url":"https://api.github.com/repos/bookshelf/bookshelf/issues/838","id":316456688,"user":{"login":"dj-hedgehog","id":7140800,"avatar_url":"https://avatars1.githubusercontent.com/u/7140800?v=4","gravatar_id":"","url":"https://api.github.com/users/dj-hedgehog","html_url":"https://github.com/dj-hedgehog","followers_url":"https://api.github.com/users/dj-hedgehog/followers","following_url":"https://api.github.com/users/dj-hedgehog/following{/other_user}","gists_url":"https://api.github.com/users/dj-hedgehog/gists{/gist_id}","starred_url":"https://api.github.com/users/dj-hedgehog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dj-hedgehog/subscriptions","organizations_url":"https://api.github.com/users/dj-hedgehog/orgs","repos_url":"https://api.github.com/users/dj-hedgehog/repos","events_url":"https://api.github.com/users/dj-hedgehog/events{/privacy}","received_events_url":"https://api.github.com/users/dj-hedgehog/received_events","type":"User","site_admin":false},"created_at":"2017-07-19T17:19:39Z","updated_at":"2017-07-19T17:19:39Z","body":"The project leadership of Bookshelf recently changed. In an effort to advance the project we close all issues older than one year.\r\n\r\nIf you think this issue needs to be re-evaluated please post a comment on why this is still important and we will re-open it.\r\n\r\nWe also started an open discussion about the future of Bookshelf.js here https://github.com/bookshelf/bookshelf/issues/1600. Feel free to drop by and give us your opinion.\r\n**Let's make Bookshelf great again**"}}
{"actor":{"display_login":"dj-hedgehog"}}