{"action":"created","issue":{"url":"https://api.github.com/repos/PCSTrac/napi/issues/4","repository_url":"https://api.github.com/repos/PCSTrac/napi","labels_url":"https://api.github.com/repos/PCSTrac/napi/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/PCSTrac/napi/issues/4/comments","events_url":"https://api.github.com/repos/PCSTrac/napi/issues/4/events","html_url":"https://github.com/PCSTrac/napi/issues/4","id":150408743,"number":4,"title":"incorrect db context used","user":{"login":"vitaly-t","id":5108906,"avatar_url":"https://avatars.githubusercontent.com/u/5108906?v=3","gravatar_id":"","url":"https://api.github.com/users/vitaly-t","html_url":"https://github.com/vitaly-t","followers_url":"https://api.github.com/users/vitaly-t/followers","following_url":"https://api.github.com/users/vitaly-t/following{/other_user}","gists_url":"https://api.github.com/users/vitaly-t/gists{/gist_id}","starred_url":"https://api.github.com/users/vitaly-t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vitaly-t/subscriptions","organizations_url":"https://api.github.com/users/vitaly-t/orgs","repos_url":"https://api.github.com/users/vitaly-t/repos","events_url":"https://api.github.com/users/vitaly-t/events{/privacy}","received_events_url":"https://api.github.com/users/vitaly-t/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2016-04-22T16:00:29Z","updated_at":"2016-04-22T16:46:32Z","closed_at":"2016-04-22T16:27:25Z","body":"from here: https://github.com/PCSTrac/napi/blob/master/test/v1/unit.js\r\n\r\ncode:\r\n```js\r\nreturn db.tx((tx) => {\r\n        return db.none(pgPromise.QueryFile('./sql/ADD_TEST_DATA.sql', {minify: true}))\r\n      })\r\n```\r\nshould be:\r\n```js\r\nreturn db.tx((tx) => {\r\n        return tx.none(pgPromise.QueryFile('./sql/ADD_TEST_DATA.sql', {minify: true}))\r\n      })\r\n```\r\nOtherwise it is breaking the transaction flow, i.e. you are executing the transaction on one connection, and the query on a different one.\r\n"},"comment":{"url":"https://api.github.com/repos/PCSTrac/napi/issues/comments/213505603","html_url":"https://github.com/PCSTrac/napi/issues/4#issuecomment-213505603","issue_url":"https://api.github.com/repos/PCSTrac/napi/issues/4","id":213505603,"user":{"login":"vitaly-t","id":5108906,"avatar_url":"https://avatars.githubusercontent.com/u/5108906?v=3","gravatar_id":"","url":"https://api.github.com/users/vitaly-t","html_url":"https://github.com/vitaly-t","followers_url":"https://api.github.com/users/vitaly-t/followers","following_url":"https://api.github.com/users/vitaly-t/following{/other_user}","gists_url":"https://api.github.com/users/vitaly-t/gists{/gist_id}","starred_url":"https://api.github.com/users/vitaly-t/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vitaly-t/subscriptions","organizations_url":"https://api.github.com/users/vitaly-t/orgs","repos_url":"https://api.github.com/users/vitaly-t/repos","events_url":"https://api.github.com/users/vitaly-t/events{/privacy}","received_events_url":"https://api.github.com/users/vitaly-t/received_events","type":"User","site_admin":false},"created_at":"2016-04-22T16:46:32Z","updated_at":"2016-04-22T16:46:32Z","body":"Actually, another reason is that QueryFile supports late error reporting, via query methods, while Prepared Statements are expected to error during construction... it's a tricky one :)"}}