{"action":"created","issue":{"url":"https://api.github.com/repos/Vincit/objection.js/issues/837","repository_url":"https://api.github.com/repos/Vincit/objection.js","labels_url":"https://api.github.com/repos/Vincit/objection.js/issues/837/labels{/name}","comments_url":"https://api.github.com/repos/Vincit/objection.js/issues/837/comments","events_url":"https://api.github.com/repos/Vincit/objection.js/issues/837/events","html_url":"https://github.com/Vincit/objection.js/issues/837","id":304193149,"number":837,"title":"joinRelation() of a m2m relation with \"extra\" properties fails when \"orderBy\" is used in modify","user":{"login":"unhawkable","id":14310995,"avatar_url":"https://avatars2.githubusercontent.com/u/14310995?v=4","gravatar_id":"","url":"https://api.github.com/users/unhawkable","html_url":"https://github.com/unhawkable","followers_url":"https://api.github.com/users/unhawkable/followers","following_url":"https://api.github.com/users/unhawkable/following{/other_user}","gists_url":"https://api.github.com/users/unhawkable/gists{/gist_id}","starred_url":"https://api.github.com/users/unhawkable/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unhawkable/subscriptions","organizations_url":"https://api.github.com/users/unhawkable/orgs","repos_url":"https://api.github.com/users/unhawkable/repos","events_url":"https://api.github.com/users/unhawkable/events{/privacy}","received_events_url":"https://api.github.com/users/unhawkable/received_events","type":"User","site_admin":false},"labels":[{"id":199461320,"url":"https://api.github.com/repos/Vincit/objection.js/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-03-11T20:57:04Z","updated_at":"2018-03-11T21:03:44Z","closed_at":null,"author_association":"NONE","body":"it's probably a followup of #760 and connected to changes from that time.\r\n\r\nPerson model has \"movies\" relation with extra: 'awesomeness' and orderBy('awesomeness', 'desc') in modify property.\r\n\r\n```\r\nawait Person.query()\r\n    .joinRelation('movies')\r\n```\r\n\r\ngenerates this sql:\r\n\r\n```\r\nselect `Person`.* from `Person` inner join `Person_Movie` as `movies_join` on `movies_join`.`personId` = `Person`.`id` inner join (select `Movie`.* from `Movie` order by `awesomeness` desc) as `movies` on `movies_join`.`movieId` = `movies`.`id`\r\n```\r\n\r\n\"awesomeness\" column is inserted in wrong place, causing the following error:\r\n\r\n```\r\nError: ER_BAD_FIELD_ERROR: Unknown column 'awesomeness' in 'order clause'\r\n```\r\n\r\nTested with v1.0.\r\nreproduction-template.js attached.\r\n[reproduction-template.zip](https://github.com/Vincit/objection.js/files/1800869/reproduction-template.zip)\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/Vincit/objection.js/issues/comments/372148959","html_url":"https://github.com/Vincit/objection.js/issues/837#issuecomment-372148959","issue_url":"https://api.github.com/repos/Vincit/objection.js/issues/837","id":372148959,"user":{"login":"koskimas","id":846508,"avatar_url":"https://avatars2.githubusercontent.com/u/846508?v=4","gravatar_id":"","url":"https://api.github.com/users/koskimas","html_url":"https://github.com/koskimas","followers_url":"https://api.github.com/users/koskimas/followers","following_url":"https://api.github.com/users/koskimas/following{/other_user}","gists_url":"https://api.github.com/users/koskimas/gists{/gist_id}","starred_url":"https://api.github.com/users/koskimas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/koskimas/subscriptions","organizations_url":"https://api.github.com/users/koskimas/orgs","repos_url":"https://api.github.com/users/koskimas/repos","events_url":"https://api.github.com/users/koskimas/events{/privacy}","received_events_url":"https://api.github.com/users/koskimas/received_events","type":"User","site_admin":false},"created_at":"2018-03-11T21:03:44Z","updated_at":"2018-03-11T21:03:44Z","author_association":"CONTRIBUTOR","body":"Thanks for the issue and reproduction! I'll fix this for the next patch release.\r\n"}}
{"actor":{"display_login":"koskimas"}}