{"action":"created","comment":{"url":"https://api.github.com/repos/graphcool/prisma/pulls/comments/182819375","pull_request_review_id":113696509,"id":182819375,"diff_hunk":"@@ -0,0 +1,78 @@\n+package com.prisma.deploy.connector.postgresql.database\n+\n+import com.prisma.shared.models.{Field, Model}\n+import slick.jdbc.PostgresProfile.api._\n+import slick.jdbc.{PositionedParameters, SQLActionBuilder}\n+\n+object PostgresDeployDatabaseQueryBuilder {\n+\n+  def existsByModel(projectId: String, modelName: String): SQLActionBuilder = {\n+    sql\"\"\"select exists (select \"id\" from \"#$projectId\".\"#$modelName\")\"\"\"\n+  }\n+\n+  def existsByRelation(projectId: String, relationId: String): SQLActionBuilder = {\n+    sql\"\"\"select exists (select \"id\" from \"#$projectId\".\"#$relationId\")\"\"\"\n+  }\n+\n+  def existsNullByModelAndScalarField(projectId: String, modelName: String, fieldName: String) = {\n+    sql\"\"\"SELECT EXISTS(Select \"id\" FROM \"#$projectId\".\"#$modelName\"\n+          WHERE \"#$projectId\".\"#$modelName\".#$fieldName IS NULL)\"\"\"\n+  }\n+\n+  def existsNullByModelAndRelationField(projectId: String, modelName: String, field: Field) = {\n+    val relationId   = field.relation.get.relationTableName\n+    val relationSide = field.relationSide.get.toString\n+    sql\"\"\"select EXISTS (\n+            select \"id\" from \"#$projectId\".\"#$modelName\"\n+            where \"id\" Not IN\n+            (Select \"#$projectId\".\"#$relationId\".\"#$relationSide\" from \"#$projectId\".\"#$relationId\")\n+          )\"\"\"\n+  }\n+\n+  def enumValueIsInUse(projectId: String, models: Vector[Model], enumName: String, value: String) = {\n+\n+    val nameTuples = for {","path":"server/connectors/deploy-connector-postgresql/src/main/scala/com/prisma/deploy/connector/postgresql/database/PostgresDeployDatabaseQueryBuilder.scala","position":34,"original_position":34,"commit_id":"16e965cae1faaf79d79b4b4fe5f2b9cf5d40121f","original_commit_id":"16e965cae1faaf79d79b4b4fe5f2b9cf5d40121f","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: [Usage of get on optional type.](https://app.codacy.com/app/graphcool/prisma/pullRequest?prid=1559610)","created_at":"2018-04-19T17:08:11Z","updated_at":"2018-04-19T17:08:12Z","html_url":"https://github.com/graphcool/prisma/pull/2238#discussion_r182819375","pull_request_url":"https://api.github.com/repos/graphcool/prisma/pulls/2238","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/graphcool/prisma/pulls/comments/182819375"},"html":{"href":"https://github.com/graphcool/prisma/pull/2238#discussion_r182819375"},"pull_request":{"href":"https://api.github.com/repos/graphcool/prisma/pulls/2238"}}},"pull_request":{"url":"https://api.github.com/repos/graphcool/prisma/pulls/2238","id":182745182,"html_url":"https://github.com/graphcool/prisma/pull/2238","diff_url":"https://github.com/graphcool/prisma/pull/2238.diff","patch_url":"https://github.com/graphcool/prisma/pull/2238.patch","issue_url":"https://api.github.com/repos/graphcool/prisma/issues/2238","number":2238,"state":"open","locked":false,"title":"[WIP] Postgres integration with new config format","user":{"login":"dpetrick","id":4272382,"avatar_url":"https://avatars0.githubusercontent.com/u/4272382?v=4","gravatar_id":"","url":"https://api.github.com/users/dpetrick","html_url":"https://github.com/dpetrick","followers_url":"https://api.github.com/users/dpetrick/followers","following_url":"https://api.github.com/users/dpetrick/following{/other_user}","gists_url":"https://api.github.com/users/dpetrick/gists{/gist_id}","starred_url":"https://api.github.com/users/dpetrick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dpetrick/subscriptions","organizations_url":"https://api.github.com/users/dpetrick/orgs","repos_url":"https://api.github.com/users/dpetrick/repos","events_url":"https://api.github.com/users/dpetrick/events{/privacy}","received_events_url":"https://api.github.com/users/dpetrick/received_events","type":"User","site_admin":false},"body":"tbd","created_at":"2018-04-19T11:23:46Z","updated_at":"2018-04-19T17:08:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"88f75374f72865d4d1f5df928ee14c77e36bd36f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/graphcool/prisma/pulls/2238/commits","review_comments_url":"https://api.github.com/repos/graphcool/prisma/pulls/2238/comments","review_comment_url":"https://api.github.com/repos/graphcool/prisma/pulls/comments{/number}","comments_url":"https://api.github.com/repos/graphcool/prisma/issues/2238/comments","statuses_url":"https://api.github.com/repos/graphcool/prisma/statuses/16e965cae1faaf79d79b4b4fe5f2b9cf5d40121f","head":{"label":"graphcool:config_integration","ref":"config_integration","sha":"16e965cae1faaf79d79b4b4fe5f2b9cf5d40121f","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-19T17:05:06Z","pushed_at":"2018-04-19T17:05:01Z","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":15186,"stargazers_count":7066,"watchers_count":7066,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":390,"mirror_url":null,"archived":false,"open_issues_count":362,"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":390,"open_issues":362,"watchers":7066,"default_branch":"master"}},"base":{"label":"graphcool:master","ref":"master","sha":"01aeae9de91b2ee383866b75c3e943f929cbb07f","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-19T17:05:06Z","pushed_at":"2018-04-19T17:05:01Z","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":15186,"stargazers_count":7066,"watchers_count":7066,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":390,"mirror_url":null,"archived":false,"open_issues_count":362,"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":390,"open_issues":362,"watchers":7066,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/graphcool/prisma/pulls/2238"},"html":{"href":"https://github.com/graphcool/prisma/pull/2238"},"issue":{"href":"https://api.github.com/repos/graphcool/prisma/issues/2238"},"comments":{"href":"https://api.github.com/repos/graphcool/prisma/issues/2238/comments"},"review_comments":{"href":"https://api.github.com/repos/graphcool/prisma/pulls/2238/comments"},"review_comment":{"href":"https://api.github.com/repos/graphcool/prisma/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/graphcool/prisma/pulls/2238/commits"},"statuses":{"href":"https://api.github.com/repos/graphcool/prisma/statuses/16e965cae1faaf79d79b4b4fe5f2b9cf5d40121f"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"codacy-bot"}}