{"action":"created","comment":{"url":"https://api.github.com/repos/graphcool/prisma/pulls/comments/180068083","pull_request_review_id":110422517,"id":180068083,"diff_hunk":"@@ -193,45 +197,43 @@ object DatabaseQueryBuilder {\n                                      fromModelIds: Vector[IdGCValue],\n                                      args: Option[QueryArguments]): DBIOAction[Vector[ResolverResult[PrismaNodeWithParent]], NoStream, Effect] = {\n \n-    val relatedModel      = fromField.relatedModel(project.schema).get\n-    val fieldTable        = fromField.relatedModel(project.schema).get.name\n-    val unsafeRelationId  = fromField.relation.get.relationTableName\n-    val modelRelationSide = fromField.relationSide.get.toString\n-    val fieldRelationSide = fromField.oppositeRelationSide.get.toString\n+    val relatedModel         = fromField.relatedModel(project.schema).get\n+    val fieldTable           = fromField.relatedModel(project.schema).get.name\n+    val unsafeRelationId     = fromField.relation.get.relationTableName\n+    val modelRelationSide    = fromField.relationSide.get.toString\n+    val oppositeRelationSide = fromField.oppositeRelationSide.get.toString\n \n     val (conditionCommand, orderByCommand, limitCommand) =\n-      extractQueryArgs(project.id, fieldTable, args, defaultOrderShortcut = Some(s\"\"\"`${project.id}`.`$unsafeRelationId`.$fieldRelationSide\"\"\"), None)\n+      extractQueryArgs(project.id, fieldTable, args, defaultOrderShortcut = Some(s\"\"\"`${project.id}`.`$unsafeRelationId`.$oppositeRelationSide\"\"\"), None)\n \n     def createQuery(id: String, modelRelationSide: String, fieldRelationSide: String) = {\n       sql\"\"\"(select `#${project.id}`.`#$fieldTable`.*, `#${project.id}`.`#$unsafeRelationId`.A as __Relation__A,  `#${project.id}`.`#$unsafeRelationId`.B as __Relation__B\n             from `#${project.id}`.`#$fieldTable`\n            inner join `#${project.id}`.`#$unsafeRelationId`\n            on `#${project.id}`.`#$fieldTable`.id = `#${project.id}`.`#$unsafeRelationId`.#$fieldRelationSide\n-           where `#${project.id}`.`#$unsafeRelationId`.#$modelRelationSide = '#$id' \"\"\" concat\n-        prefixIfNotNone(\"and\", conditionCommand) concat\n-        prefixIfNotNone(\"order by\", orderByCommand) concat\n-        prefixIfNotNone(\"limit\", limitCommand) concat sql\")\"\n+           where `#${project.id}`.`#$unsafeRelationId`.#$modelRelationSide = '#$id' \"\"\" ++\n+        prefixIfNotNone(\"and\", conditionCommand) ++\n+        prefixIfNotNone(\"order by\", orderByCommand) ++\n+        prefixIfNotNone(\"limit\", limitCommand) ++ sql\")\"\n     }\n \n     // see https://github.com/graphcool/internal-docs/blob/master/relations.md#findings\n-    val resolveFromBothSidesAndMerge = fromField.relation.get.isSameFieldSameModelRelation(project.schema) && !fromField.isList\n+    val resolveFromBothSidesAndMerge = fromField.relation.get.isSameFieldSameModelRelation(project.schema)\n \n     val query = resolveFromBothSidesAndMerge match {\n       case false =>\n         fromModelIds.distinct.view.zipWithIndex.foldLeft(sql\"\")((a, b) =>\n-          a concat unionIfNotFirst(b._2) concat createQuery(b._1.value, modelRelationSide, fieldRelationSide))\n+          a ++ unionIfNotFirst(b._2) ++ createQuery(b._1.value, modelRelationSide, oppositeRelationSide))","path":"server/connectors/api-connector-mysql/src/main/scala/com/prisma/api/connector/mysql/database/DatabaseQueryBuilder.scala","position":118,"original_position":118,"commit_id":"8f2170e159b97676dc414d8223d40ef1dfd1b09a","original_commit_id":"8f2170e159b97676dc414d8223d40ef1dfd1b09a","user":{"login":"codacy-bot","id":19940114,"avatar_url":"https://avatars1.githubusercontent.com/u/19940114?v=4","gravatar_id":"","url":"https://api.github.com/users/codacy-bot","html_url":"https://github.com/codacy-bot","followers_url":"https://api.github.com/users/codacy-bot/followers","following_url":"https://api.github.com/users/codacy-bot/following{/other_user}","gists_url":"https://api.github.com/users/codacy-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/codacy-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codacy-bot/subscriptions","organizations_url":"https://api.github.com/users/codacy-bot/orgs","repos_url":"https://api.github.com/users/codacy-bot/repos","events_url":"https://api.github.com/users/codacy-bot/events{/privacy}","received_events_url":"https://api.github.com/users/codacy-bot/received_events","type":"User","site_admin":false},"body":"![Codacy](https://app.codacy.com/assets/images/favicon.png) Issue found: [Found unnamed result or parameter](https://app.codacy.com/app/graphcool/prisma/pullRequest?prid=1519055)","created_at":"2018-04-09T11:47:26Z","updated_at":"2018-04-09T11:47:26Z","html_url":"https://github.com/graphcool/prisma/pull/2202#discussion_r180068083","pull_request_url":"https://api.github.com/repos/graphcool/prisma/pulls/2202","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/graphcool/prisma/pulls/comments/180068083"},"html":{"href":"https://github.com/graphcool/prisma/pull/2202#discussion_r180068083"},"pull_request":{"href":"https://api.github.com/repos/graphcool/prisma/pulls/2202"}}},"pull_request":{"url":"https://api.github.com/repos/graphcool/prisma/pulls/2202","id":180286525,"html_url":"https://github.com/graphcool/prisma/pull/2202","diff_url":"https://github.com/graphcool/prisma/pull/2202.diff","patch_url":"https://github.com/graphcool/prisma/pull/2202.patch","issue_url":"https://api.github.com/repos/graphcool/prisma/issues/2202","number":2202,"state":"open","locked":false,"title":"Deeply nested self relations not executed","user":{"login":"do4gr","id":16278407,"avatar_url":"https://avatars2.githubusercontent.com/u/16278407?v=4","gravatar_id":"","url":"https://api.github.com/users/do4gr","html_url":"https://github.com/do4gr","followers_url":"https://api.github.com/users/do4gr/followers","following_url":"https://api.github.com/users/do4gr/following{/other_user}","gists_url":"https://api.github.com/users/do4gr/gists{/gist_id}","starred_url":"https://api.github.com/users/do4gr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/do4gr/subscriptions","organizations_url":"https://api.github.com/users/do4gr/orgs","repos_url":"https://api.github.com/users/do4gr/repos","events_url":"https://api.github.com/users/do4gr/events{/privacy}","received_events_url":"https://api.github.com/users/do4gr/received_events","type":"User","site_admin":false},"body":"Fixes https://github.com/graphcool/prisma/issues/2089","created_at":"2018-04-09T11:45:05Z","updated_at":"2018-04-09T11:47:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"eb83e7ce1162e068dd8e92c39b19cd3878921b75","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/graphcool/prisma/pulls/2202/commits","review_comments_url":"https://api.github.com/repos/graphcool/prisma/pulls/2202/comments","review_comment_url":"https://api.github.com/repos/graphcool/prisma/pulls/comments{/number}","comments_url":"https://api.github.com/repos/graphcool/prisma/issues/2202/comments","statuses_url":"https://api.github.com/repos/graphcool/prisma/statuses/8f2170e159b97676dc414d8223d40ef1dfd1b09a","head":{"label":"graphcool:DeeplyNestedSelfRelationsNotExecuted","ref":"DeeplyNestedSelfRelationsNotExecuted","sha":"8f2170e159b97676dc414d8223d40ef1dfd1b09a","user":{"login":"graphcool","id":17219288,"avatar_url":"https://avatars0.githubusercontent.com/u/17219288?v=4","gravatar_id":"","url":"https://api.github.com/users/graphcool","html_url":"https://github.com/graphcool","followers_url":"https://api.github.com/users/graphcool/followers","following_url":"https://api.github.com/users/graphcool/following{/other_user}","gists_url":"https://api.github.com/users/graphcool/gists{/gist_id}","starred_url":"https://api.github.com/users/graphcool/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/graphcool/subscriptions","organizations_url":"https://api.github.com/users/graphcool/orgs","repos_url":"https://api.github.com/users/graphcool/repos","events_url":"https://api.github.com/users/graphcool/events{/privacy}","received_events_url":"https://api.github.com/users/graphcool/received_events","type":"Organization","site_admin":false},"repo":{"id":69164196,"name":"prisma","full_name":"graphcool/prisma","owner":{"login":"graphcool","id":17219288,"avatar_url":"https://avatars0.githubusercontent.com/u/17219288?v=4","gravatar_id":"","url":"https://api.github.com/users/graphcool","html_url":"https://github.com/graphcool","followers_url":"https://api.github.com/users/graphcool/followers","following_url":"https://api.github.com/users/graphcool/following{/other_user}","gists_url":"https://api.github.com/users/graphcool/gists{/gist_id}","starred_url":"https://api.github.com/users/graphcool/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/graphcool/subscriptions","organizations_url":"https://api.github.com/users/graphcool/orgs","repos_url":"https://api.github.com/users/graphcool/repos","events_url":"https://api.github.com/users/graphcool/events{/privacy}","received_events_url":"https://api.github.com/users/graphcool/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/graphcool/prisma","description":"⚡️ Prisma turns your database into a realtime GraphQL API","fork":false,"url":"https://api.github.com/repos/graphcool/prisma","forks_url":"https://api.github.com/repos/graphcool/prisma/forks","keys_url":"https://api.github.com/repos/graphcool/prisma/keys{/key_id}","collaborators_url":"https://api.github.com/repos/graphcool/prisma/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/graphcool/prisma/teams","hooks_url":"https://api.github.com/repos/graphcool/prisma/hooks","issue_events_url":"https://api.github.com/repos/graphcool/prisma/issues/events{/number}","events_url":"https://api.github.com/repos/graphcool/prisma/events","assignees_url":"https://api.github.com/repos/graphcool/prisma/assignees{/user}","branches_url":"https://api.github.com/repos/graphcool/prisma/branches{/branch}","tags_url":"https://api.github.com/repos/graphcool/prisma/tags","blobs_url":"https://api.github.com/repos/graphcool/prisma/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/graphcool/prisma/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/graphcool/prisma/git/refs{/sha}","trees_url":"https://api.github.com/repos/graphcool/prisma/git/trees{/sha}","statuses_url":"https://api.github.com/repos/graphcool/prisma/statuses/{sha}","languages_url":"https://api.github.com/repos/graphcool/prisma/languages","stargazers_url":"https://api.github.com/repos/graphcool/prisma/stargazers","contributors_url":"https://api.github.com/repos/graphcool/prisma/contributors","subscribers_url":"https://api.github.com/repos/graphcool/prisma/subscribers","subscription_url":"https://api.github.com/repos/graphcool/prisma/subscription","commits_url":"https://api.github.com/repos/graphcool/prisma/commits{/sha}","git_commits_url":"https://api.github.com/repos/graphcool/prisma/git/commits{/sha}","comments_url":"https://api.github.com/repos/graphcool/prisma/comments{/number}","issue_comment_url":"https://api.github.com/repos/graphcool/prisma/issues/comments{/number}","contents_url":"https://api.github.com/repos/graphcool/prisma/contents/{+path}","compare_url":"https://api.github.com/repos/graphcool/prisma/compare/{base}...{head}","merges_url":"https://api.github.com/repos/graphcool/prisma/merges","archive_url":"https://api.github.com/repos/graphcool/prisma/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/graphcool/prisma/downloads","issues_url":"https://api.github.com/repos/graphcool/prisma/issues{/number}","pulls_url":"https://api.github.com/repos/graphcool/prisma/pulls{/number}","milestones_url":"https://api.github.com/repos/graphcool/prisma/milestones{/number}","notifications_url":"https://api.github.com/repos/graphcool/prisma/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/graphcool/prisma/labels{/name}","releases_url":"https://api.github.com/repos/graphcool/prisma/releases{/id}","deployments_url":"https://api.github.com/repos/graphcool/prisma/deployments","created_at":"2016-09-25T12:54:40Z","updated_at":"2018-04-09T11:30:25Z","pushed_at":"2018-04-09T11:45:05Z","git_url":"git://github.com/graphcool/prisma.git","ssh_url":"git@github.com:graphcool/prisma.git","clone_url":"https://github.com/graphcool/prisma.git","svn_url":"https://github.com/graphcool/prisma","homepage":"https://www.prisma.io/","size":14423,"stargazers_count":6876,"watchers_count":6876,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":387,"mirror_url":null,"archived":false,"open_issues_count":367,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":387,"open_issues":367,"watchers":6876,"default_branch":"master"}},"base":{"label":"graphcool:master","ref":"master","sha":"72727091e52a7cbe84fffcc19c6d80c2e42249cd","user":{"login":"graphcool","id":17219288,"avatar_url":"https://avatars0.githubusercontent.com/u/17219288?v=4","gravatar_id":"","url":"https://api.github.com/users/graphcool","html_url":"https://github.com/graphcool","followers_url":"https://api.github.com/users/graphcool/followers","following_url":"https://api.github.com/users/graphcool/following{/other_user}","gists_url":"https://api.github.com/users/graphcool/gists{/gist_id}","starred_url":"https://api.github.com/users/graphcool/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/graphcool/subscriptions","organizations_url":"https://api.github.com/users/graphcool/orgs","repos_url":"https://api.github.com/users/graphcool/repos","events_url":"https://api.github.com/users/graphcool/events{/privacy}","received_events_url":"https://api.github.com/users/graphcool/received_events","type":"Organization","site_admin":false},"repo":{"id":69164196,"name":"prisma","full_name":"graphcool/prisma","owner":{"login":"graphcool","id":17219288,"avatar_url":"https://avatars0.githubusercontent.com/u/17219288?v=4","gravatar_id":"","url":"https://api.github.com/users/graphcool","html_url":"https://github.com/graphcool","followers_url":"https://api.github.com/users/graphcool/followers","following_url":"https://api.github.com/users/graphcool/following{/other_user}","gists_url":"https://api.github.com/users/graphcool/gists{/gist_id}","starred_url":"https://api.github.com/users/graphcool/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/graphcool/subscriptions","organizations_url":"https://api.github.com/users/graphcool/orgs","repos_url":"https://api.github.com/users/graphcool/repos","events_url":"https://api.github.com/users/graphcool/events{/privacy}","received_events_url":"https://api.github.com/users/graphcool/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/graphcool/prisma","description":"⚡️ Prisma turns your database into a realtime GraphQL API","fork":false,"url":"https://api.github.com/repos/graphcool/prisma","forks_url":"https://api.github.com/repos/graphcool/prisma/forks","keys_url":"https://api.github.com/repos/graphcool/prisma/keys{/key_id}","collaborators_url":"https://api.github.com/repos/graphcool/prisma/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/graphcool/prisma/teams","hooks_url":"https://api.github.com/repos/graphcool/prisma/hooks","issue_events_url":"https://api.github.com/repos/graphcool/prisma/issues/events{/number}","events_url":"https://api.github.com/repos/graphcool/prisma/events","assignees_url":"https://api.github.com/repos/graphcool/prisma/assignees{/user}","branches_url":"https://api.github.com/repos/graphcool/prisma/branches{/branch}","tags_url":"https://api.github.com/repos/graphcool/prisma/tags","blobs_url":"https://api.github.com/repos/graphcool/prisma/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/graphcool/prisma/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/graphcool/prisma/git/refs{/sha}","trees_url":"https://api.github.com/repos/graphcool/prisma/git/trees{/sha}","statuses_url":"https://api.github.com/repos/graphcool/prisma/statuses/{sha}","languages_url":"https://api.github.com/repos/graphcool/prisma/languages","stargazers_url":"https://api.github.com/repos/graphcool/prisma/stargazers","contributors_url":"https://api.github.com/repos/graphcool/prisma/contributors","subscribers_url":"https://api.github.com/repos/graphcool/prisma/subscribers","subscription_url":"https://api.github.com/repos/graphcool/prisma/subscription","commits_url":"https://api.github.com/repos/graphcool/prisma/commits{/sha}","git_commits_url":"https://api.github.com/repos/graphcool/prisma/git/commits{/sha}","comments_url":"https://api.github.com/repos/graphcool/prisma/comments{/number}","issue_comment_url":"https://api.github.com/repos/graphcool/prisma/issues/comments{/number}","contents_url":"https://api.github.com/repos/graphcool/prisma/contents/{+path}","compare_url":"https://api.github.com/repos/graphcool/prisma/compare/{base}...{head}","merges_url":"https://api.github.com/repos/graphcool/prisma/merges","archive_url":"https://api.github.com/repos/graphcool/prisma/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/graphcool/prisma/downloads","issues_url":"https://api.github.com/repos/graphcool/prisma/issues{/number}","pulls_url":"https://api.github.com/repos/graphcool/prisma/pulls{/number}","milestones_url":"https://api.github.com/repos/graphcool/prisma/milestones{/number}","notifications_url":"https://api.github.com/repos/graphcool/prisma/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/graphcool/prisma/labels{/name}","releases_url":"https://api.github.com/repos/graphcool/prisma/releases{/id}","deployments_url":"https://api.github.com/repos/graphcool/prisma/deployments","created_at":"2016-09-25T12:54:40Z","updated_at":"2018-04-09T11:30:25Z","pushed_at":"2018-04-09T11:45:05Z","git_url":"git://github.com/graphcool/prisma.git","ssh_url":"git@github.com:graphcool/prisma.git","clone_url":"https://github.com/graphcool/prisma.git","svn_url":"https://github.com/graphcool/prisma","homepage":"https://www.prisma.io/","size":14423,"stargazers_count":6876,"watchers_count":6876,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":387,"mirror_url":null,"archived":false,"open_issues_count":367,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":387,"open_issues":367,"watchers":6876,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/graphcool/prisma/pulls/2202"},"html":{"href":"https://github.com/graphcool/prisma/pull/2202"},"issue":{"href":"https://api.github.com/repos/graphcool/prisma/issues/2202"},"comments":{"href":"https://api.github.com/repos/graphcool/prisma/issues/2202/comments"},"review_comments":{"href":"https://api.github.com/repos/graphcool/prisma/pulls/2202/comments"},"review_comment":{"href":"https://api.github.com/repos/graphcool/prisma/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/graphcool/prisma/pulls/2202/commits"},"statuses":{"href":"https://api.github.com/repos/graphcool/prisma/statuses/8f2170e159b97676dc414d8223d40ef1dfd1b09a"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"codacy-bot"}}