{"action":"created","comment":{"url":"https://api.github.com/repos/prismagraphql/prisma/pulls/comments/190193611","pull_request_review_id":122517895,"id":190193611,"diff_hunk":"@@ -79,56 +54,25 @@ class MySqlDatabaseQueryBuilder()(implicit ec: ExecutionContext) {\n     ScalarListElement(nodeId, position, value)\n   }\n \n-  def selectAllFromTable(\n-      projectId: String,\n-      model: Model,\n-      args: Option[QueryArguments],\n-      overrideMaxNodeCount: Option[Int] = None\n-  ): DBIOAction[ResolverResult[PrismaNode], NoStream, Effect] = {\n-\n-    val tableName                                        = model.name\n-    val (conditionCommand, orderByCommand, limitCommand) = extractQueryArgs(projectId, tableName, args, None, overrideMaxNodeCount = overrideMaxNodeCount)\n-\n-    val query = sql\"select * from `#$projectId`.`#$tableName`\" ++\n-      prefixIfNotNone(\"where\", conditionCommand) ++\n-      prefixIfNotNone(\"order by\", orderByCommand) ++\n-      prefixIfNotNone(\"limit\", limitCommand)\n+  private def whereOrderByLimitCommands(args: Option[QueryArguments], overrideMaxNodeCount: Option[Int], tableName: String, forList: Boolean = false) = {\n+    val (where, orderBy, limit) = extractQueryArgs(project.id, alias = ALIAS, tableName, args, None, overrideMaxNodeCount, forList)\n+    sql\"\" ++ prefixIfNotNone(\"where\", where) ++ prefixIfNotNone(\"order by\", orderBy) ++ prefixIfNotNone(\"limit\", limit)\n+  }\n \n+  def selectAllFromTable(model: Model, args: Option[QueryArguments], overrideMaxNodeCount: Option[Int] = None) = {\n+    val query = sql\"\"\"select * from `#${project.id}`.`#${model.name}` as `#${ALIAS}` \"\"\" ++ whereOrderByLimitCommands(args, overrideMaxNodeCount, model.name)\n     query.as[PrismaNode](getResultForModel(model)).map(args.get.resultTransform)\n   }\n \n-  def selectAllFromRelationTable(\n-      projectId: String,\n-      relationId: String,\n-      args: Option[QueryArguments],\n-      overrideMaxNodeCount: Option[Int] = None\n-  ): DBIOAction[ResolverResult[RelationNode], NoStream, Effect] = {\n-\n-    val tableName                                        = relationId\n-    val (conditionCommand, orderByCommand, limitCommand) = extractQueryArgs(projectId, tableName, args, None, overrideMaxNodeCount = overrideMaxNodeCount)\n-\n-    val query = sql\"select * from `#$projectId`.`#$tableName`\" ++\n-      prefixIfNotNone(\"where\", conditionCommand) ++\n-      prefixIfNotNone(\"order by\", orderByCommand) ++\n-      prefixIfNotNone(\"limit\", limitCommand)\n-\n+  def selectAllFromRelationTable(relationId: String, args: Option[QueryArguments], overrideMaxNodeCount: Option[Int] = None) = {\n+    val query = sql\"\"\"select * from `#${project.id}`.`#$relationId` as `#${ALIAS}` \"\"\" ++ whereOrderByLimitCommands(args, overrideMaxNodeCount, relationId)","path":"server/connectors/api-connector-mysql/src/main/scala/com/prisma/api/connector/mysql/database/MySqlApiDatabaseQueryBuilder.scala","position":94,"original_position":94,"commit_id":"725db2bda575adac0bc09d2302b95a9274325aa6","original_commit_id":"725db2bda575adac0bc09d2302b95a9274325aa6","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: [Don't use SELECT * in SQL queries](https://app.codacy.com/app/graphcool/prisma/pullRequest?prid=1667829)","created_at":"2018-05-23T10:11:49Z","updated_at":"2018-05-23T10:11:49Z","html_url":"https://github.com/prismagraphql/prisma/pull/2470#discussion_r190193611","pull_request_url":"https://api.github.com/repos/prismagraphql/prisma/pulls/2470","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/prismagraphql/prisma/pulls/comments/190193611"},"html":{"href":"https://github.com/prismagraphql/prisma/pull/2470#discussion_r190193611"},"pull_request":{"href":"https://api.github.com/repos/prismagraphql/prisma/pulls/2470"}}},"pull_request":{"url":"https://api.github.com/repos/prismagraphql/prisma/pulls/2470","id":189077135,"html_url":"https://github.com/prismagraphql/prisma/pull/2470","diff_url":"https://github.com/prismagraphql/prisma/pull/2470.diff","patch_url":"https://github.com/prismagraphql/prisma/pull/2470.patch","issue_url":"https://api.github.com/repos/prismagraphql/prisma/issues/2470","number":2470,"state":"open","locked":false,"title":"[WIP] Refactor Filters","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":"","created_at":"2018-05-18T16:34:14Z","updated_at":"2018-05-23T10:11:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f0715e628ab83d1db1c9769c174a836459a60b8b","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/prismagraphql/prisma/pulls/2470/commits","review_comments_url":"https://api.github.com/repos/prismagraphql/prisma/pulls/2470/comments","review_comment_url":"https://api.github.com/repos/prismagraphql/prisma/pulls/comments{/number}","comments_url":"https://api.github.com/repos/prismagraphql/prisma/issues/2470/comments","statuses_url":"https://api.github.com/repos/prismagraphql/prisma/statuses/725db2bda575adac0bc09d2302b95a9274325aa6","head":{"label":"prismagraphql:FlattenNestedSQLQueries","ref":"FlattenNestedSQLQueries","sha":"725db2bda575adac0bc09d2302b95a9274325aa6","user":{"login":"prismagraphql","id":17219288,"avatar_url":"https://avatars0.githubusercontent.com/u/17219288?v=4","gravatar_id":"","url":"https://api.github.com/users/prismagraphql","html_url":"https://github.com/prismagraphql","followers_url":"https://api.github.com/users/prismagraphql/followers","following_url":"https://api.github.com/users/prismagraphql/following{/other_user}","gists_url":"https://api.github.com/users/prismagraphql/gists{/gist_id}","starred_url":"https://api.github.com/users/prismagraphql/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prismagraphql/subscriptions","organizations_url":"https://api.github.com/users/prismagraphql/orgs","repos_url":"https://api.github.com/users/prismagraphql/repos","events_url":"https://api.github.com/users/prismagraphql/events{/privacy}","received_events_url":"https://api.github.com/users/prismagraphql/received_events","type":"Organization","site_admin":false},"repo":{"id":69164196,"name":"prisma","full_name":"prismagraphql/prisma","owner":{"login":"prismagraphql","id":17219288,"avatar_url":"https://avatars0.githubusercontent.com/u/17219288?v=4","gravatar_id":"","url":"https://api.github.com/users/prismagraphql","html_url":"https://github.com/prismagraphql","followers_url":"https://api.github.com/users/prismagraphql/followers","following_url":"https://api.github.com/users/prismagraphql/following{/other_user}","gists_url":"https://api.github.com/users/prismagraphql/gists{/gist_id}","starred_url":"https://api.github.com/users/prismagraphql/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prismagraphql/subscriptions","organizations_url":"https://api.github.com/users/prismagraphql/orgs","repos_url":"https://api.github.com/users/prismagraphql/repos","events_url":"https://api.github.com/users/prismagraphql/events{/privacy}","received_events_url":"https://api.github.com/users/prismagraphql/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/prismagraphql/prisma","description":"⚡️ Prisma turns your database into a realtime GraphQL API","fork":false,"url":"https://api.github.com/repos/prismagraphql/prisma","forks_url":"https://api.github.com/repos/prismagraphql/prisma/forks","keys_url":"https://api.github.com/repos/prismagraphql/prisma/keys{/key_id}","collaborators_url":"https://api.github.com/repos/prismagraphql/prisma/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/prismagraphql/prisma/teams","hooks_url":"https://api.github.com/repos/prismagraphql/prisma/hooks","issue_events_url":"https://api.github.com/repos/prismagraphql/prisma/issues/events{/number}","events_url":"https://api.github.com/repos/prismagraphql/prisma/events","assignees_url":"https://api.github.com/repos/prismagraphql/prisma/assignees{/user}","branches_url":"https://api.github.com/repos/prismagraphql/prisma/branches{/branch}","tags_url":"https://api.github.com/repos/prismagraphql/prisma/tags","blobs_url":"https://api.github.com/repos/prismagraphql/prisma/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/prismagraphql/prisma/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/prismagraphql/prisma/git/refs{/sha}","trees_url":"https://api.github.com/repos/prismagraphql/prisma/git/trees{/sha}","statuses_url":"https://api.github.com/repos/prismagraphql/prisma/statuses/{sha}","languages_url":"https://api.github.com/repos/prismagraphql/prisma/languages","stargazers_url":"https://api.github.com/repos/prismagraphql/prisma/stargazers","contributors_url":"https://api.github.com/repos/prismagraphql/prisma/contributors","subscribers_url":"https://api.github.com/repos/prismagraphql/prisma/subscribers","subscription_url":"https://api.github.com/repos/prismagraphql/prisma/subscription","commits_url":"https://api.github.com/repos/prismagraphql/prisma/commits{/sha}","git_commits_url":"https://api.github.com/repos/prismagraphql/prisma/git/commits{/sha}","comments_url":"https://api.github.com/repos/prismagraphql/prisma/comments{/number}","issue_comment_url":"https://api.github.com/repos/prismagraphql/prisma/issues/comments{/number}","contents_url":"https://api.github.com/repos/prismagraphql/prisma/contents/{+path}","compare_url":"https://api.github.com/repos/prismagraphql/prisma/compare/{base}...{head}","merges_url":"https://api.github.com/repos/prismagraphql/prisma/merges","archive_url":"https://api.github.com/repos/prismagraphql/prisma/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/prismagraphql/prisma/downloads","issues_url":"https://api.github.com/repos/prismagraphql/prisma/issues{/number}","pulls_url":"https://api.github.com/repos/prismagraphql/prisma/pulls{/number}","milestones_url":"https://api.github.com/repos/prismagraphql/prisma/milestones{/number}","notifications_url":"https://api.github.com/repos/prismagraphql/prisma/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/prismagraphql/prisma/labels{/name}","releases_url":"https://api.github.com/repos/prismagraphql/prisma/releases{/id}","deployments_url":"https://api.github.com/repos/prismagraphql/prisma/deployments","created_at":"2016-09-25T12:54:40Z","updated_at":"2018-05-23T08:49:22Z","pushed_at":"2018-05-23T09:27:55Z","git_url":"git://github.com/prismagraphql/prisma.git","ssh_url":"git@github.com:prismagraphql/prisma.git","clone_url":"https://github.com/prismagraphql/prisma.git","svn_url":"https://github.com/prismagraphql/prisma","homepage":"https://www.prisma.io/","size":16987,"stargazers_count":8351,"watchers_count":8351,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":456,"mirror_url":null,"archived":false,"open_issues_count":459,"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":456,"open_issues":459,"watchers":8351,"default_branch":"master"}},"base":{"label":"prismagraphql:alpha","ref":"alpha","sha":"ec9ca7158673e41c5aa0a113daf9330b29d7e49c","user":{"login":"prismagraphql","id":17219288,"avatar_url":"https://avatars0.githubusercontent.com/u/17219288?v=4","gravatar_id":"","url":"https://api.github.com/users/prismagraphql","html_url":"https://github.com/prismagraphql","followers_url":"https://api.github.com/users/prismagraphql/followers","following_url":"https://api.github.com/users/prismagraphql/following{/other_user}","gists_url":"https://api.github.com/users/prismagraphql/gists{/gist_id}","starred_url":"https://api.github.com/users/prismagraphql/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prismagraphql/subscriptions","organizations_url":"https://api.github.com/users/prismagraphql/orgs","repos_url":"https://api.github.com/users/prismagraphql/repos","events_url":"https://api.github.com/users/prismagraphql/events{/privacy}","received_events_url":"https://api.github.com/users/prismagraphql/received_events","type":"Organization","site_admin":false},"repo":{"id":69164196,"name":"prisma","full_name":"prismagraphql/prisma","owner":{"login":"prismagraphql","id":17219288,"avatar_url":"https://avatars0.githubusercontent.com/u/17219288?v=4","gravatar_id":"","url":"https://api.github.com/users/prismagraphql","html_url":"https://github.com/prismagraphql","followers_url":"https://api.github.com/users/prismagraphql/followers","following_url":"https://api.github.com/users/prismagraphql/following{/other_user}","gists_url":"https://api.github.com/users/prismagraphql/gists{/gist_id}","starred_url":"https://api.github.com/users/prismagraphql/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prismagraphql/subscriptions","organizations_url":"https://api.github.com/users/prismagraphql/orgs","repos_url":"https://api.github.com/users/prismagraphql/repos","events_url":"https://api.github.com/users/prismagraphql/events{/privacy}","received_events_url":"https://api.github.com/users/prismagraphql/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/prismagraphql/prisma","description":"⚡️ Prisma turns your database into a realtime GraphQL API","fork":false,"url":"https://api.github.com/repos/prismagraphql/prisma","forks_url":"https://api.github.com/repos/prismagraphql/prisma/forks","keys_url":"https://api.github.com/repos/prismagraphql/prisma/keys{/key_id}","collaborators_url":"https://api.github.com/repos/prismagraphql/prisma/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/prismagraphql/prisma/teams","hooks_url":"https://api.github.com/repos/prismagraphql/prisma/hooks","issue_events_url":"https://api.github.com/repos/prismagraphql/prisma/issues/events{/number}","events_url":"https://api.github.com/repos/prismagraphql/prisma/events","assignees_url":"https://api.github.com/repos/prismagraphql/prisma/assignees{/user}","branches_url":"https://api.github.com/repos/prismagraphql/prisma/branches{/branch}","tags_url":"https://api.github.com/repos/prismagraphql/prisma/tags","blobs_url":"https://api.github.com/repos/prismagraphql/prisma/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/prismagraphql/prisma/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/prismagraphql/prisma/git/refs{/sha}","trees_url":"https://api.github.com/repos/prismagraphql/prisma/git/trees{/sha}","statuses_url":"https://api.github.com/repos/prismagraphql/prisma/statuses/{sha}","languages_url":"https://api.github.com/repos/prismagraphql/prisma/languages","stargazers_url":"https://api.github.com/repos/prismagraphql/prisma/stargazers","contributors_url":"https://api.github.com/repos/prismagraphql/prisma/contributors","subscribers_url":"https://api.github.com/repos/prismagraphql/prisma/subscribers","subscription_url":"https://api.github.com/repos/prismagraphql/prisma/subscription","commits_url":"https://api.github.com/repos/prismagraphql/prisma/commits{/sha}","git_commits_url":"https://api.github.com/repos/prismagraphql/prisma/git/commits{/sha}","comments_url":"https://api.github.com/repos/prismagraphql/prisma/comments{/number}","issue_comment_url":"https://api.github.com/repos/prismagraphql/prisma/issues/comments{/number}","contents_url":"https://api.github.com/repos/prismagraphql/prisma/contents/{+path}","compare_url":"https://api.github.com/repos/prismagraphql/prisma/compare/{base}...{head}","merges_url":"https://api.github.com/repos/prismagraphql/prisma/merges","archive_url":"https://api.github.com/repos/prismagraphql/prisma/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/prismagraphql/prisma/downloads","issues_url":"https://api.github.com/repos/prismagraphql/prisma/issues{/number}","pulls_url":"https://api.github.com/repos/prismagraphql/prisma/pulls{/number}","milestones_url":"https://api.github.com/repos/prismagraphql/prisma/milestones{/number}","notifications_url":"https://api.github.com/repos/prismagraphql/prisma/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/prismagraphql/prisma/labels{/name}","releases_url":"https://api.github.com/repos/prismagraphql/prisma/releases{/id}","deployments_url":"https://api.github.com/repos/prismagraphql/prisma/deployments","created_at":"2016-09-25T12:54:40Z","updated_at":"2018-05-23T08:49:22Z","pushed_at":"2018-05-23T09:27:55Z","git_url":"git://github.com/prismagraphql/prisma.git","ssh_url":"git@github.com:prismagraphql/prisma.git","clone_url":"https://github.com/prismagraphql/prisma.git","svn_url":"https://github.com/prismagraphql/prisma","homepage":"https://www.prisma.io/","size":16987,"stargazers_count":8351,"watchers_count":8351,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":456,"mirror_url":null,"archived":false,"open_issues_count":459,"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":456,"open_issues":459,"watchers":8351,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/prismagraphql/prisma/pulls/2470"},"html":{"href":"https://github.com/prismagraphql/prisma/pull/2470"},"issue":{"href":"https://api.github.com/repos/prismagraphql/prisma/issues/2470"},"comments":{"href":"https://api.github.com/repos/prismagraphql/prisma/issues/2470/comments"},"review_comments":{"href":"https://api.github.com/repos/prismagraphql/prisma/pulls/2470/comments"},"review_comment":{"href":"https://api.github.com/repos/prismagraphql/prisma/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/prismagraphql/prisma/pulls/2470/commits"},"statuses":{"href":"https://api.github.com/repos/prismagraphql/prisma/statuses/725db2bda575adac0bc09d2302b95a9274325aa6"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"codacy-bot"}}