{"action":"created","comment":{"url":"https://api.github.com/repos/scalableminds/webknossos/pulls/comments/214962065","pull_request_review_id":152122177,"id":214962065,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNDk2MjA2NQ==","diff_hunk":"@@ -0,0 +1,160 @@\n+#!/usr/bin/env node\n+/* eslint-disable import/no-extraneous-dependencies */\n+const program = require(\"commander\");\n+const randomstring = require(\"randomstring\");\n+const execSync = require(\"child_process\").execSync;\n+const path = require(\"path\");\n+const fs = require(\"fs\");\n+const glob = require(\"glob\");\n+const tmp = require(\"tmp\");\n+const rimraf = require(\"rimraf\");\n+const replace = require(\"replace-in-file\");\n+\n+let POSTGRES_URL = process.env.POSTGRES_URL;\n+const ORIGINAL_POSTGRES_URL =\n+  typeof POSTGRES_URL !== \"undefined\" ? POSTGRES_URL : \"jdbc:postgresql://localhost/webknossos\";\n+const scriptdir = __dirname;\n+const scriptName = __filename;\n+let p1;\n+let p2;\n+let dir1;\n+let dir2;\n+\n+function dump(parameter) {\n+  if (parameter === \"DB\") {\n+    POSTGRES_URL = ORIGINAL_POSTGRES_URL; // this environment variable is passed to dump_schema.sh\n+    return dumpToFolder();\n+  } else {\n+    const { dbName, dbHost } = initTmpDB();\n+    console.log(`Creating DB ${dbName}`);\n+    execSync(`psql -U postgres -h ${dbHost} -c \"CREATE DATABASE ${dbName};\"`, {\n+      env: { PGPASSWORD: \"postgres\" },\n+    });\n+    try {\n+      loadDataIntoDB(parameter, dbHost, dbName);\n+      return dumpToFolder();\n+    } catch (err) {\n+      console.log(err);\n+      process.exit(1);\n+    } finally {\n+      console.log(`CLEANUP: DROP DATABASE ${dbName}`);\n+      execSync(`psql -U postgres -h ${dbHost} -c \"DROP DATABASE ${dbName};\"`, {\n+        env: { PGPASSWORD: \"postgres\" },\n+      });\n+    }\n+  }\n+  return null;\n+}\n+\n+function initTmpDB() {\n+  const tempDbName = generateRandomName();\n+  const postgresDirname = path.dirname(ORIGINAL_POSTGRES_URL);","path":"tools/postgres/diff_schema.js","position":51,"original_position":51,"commit_id":"8252e975255537440fb4ebc63e74cd83de8ad6d6","original_commit_id":"8252e975255537440fb4ebc63e74cd83de8ad6d6","user":{"login":"normanrz","id":335438,"node_id":"MDQ6VXNlcjMzNTQzOA==","avatar_url":"https://avatars1.githubusercontent.com/u/335438?v=4","gravatar_id":"","url":"https://api.github.com/users/normanrz","html_url":"https://github.com/normanrz","followers_url":"https://api.github.com/users/normanrz/followers","following_url":"https://api.github.com/users/normanrz/following{/other_user}","gists_url":"https://api.github.com/users/normanrz/gists{/gist_id}","starred_url":"https://api.github.com/users/normanrz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/normanrz/subscriptions","organizations_url":"https://api.github.com/users/normanrz/orgs","repos_url":"https://api.github.com/users/normanrz/repos","events_url":"https://api.github.com/users/normanrz/events{/privacy}","received_events_url":"https://api.github.com/users/normanrz/received_events","type":"User","site_admin":false},"body":"what is actually the dirname? Is it the database name?","created_at":"2018-09-04T15:29:45Z","updated_at":"2018-09-04T15:31:54Z","html_url":"https://github.com/scalableminds/webknossos/pull/3135#discussion_r214962065","pull_request_url":"https://api.github.com/repos/scalableminds/webknossos/pulls/3135","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/scalableminds/webknossos/pulls/comments/214962065"},"html":{"href":"https://github.com/scalableminds/webknossos/pull/3135#discussion_r214962065"},"pull_request":{"href":"https://api.github.com/repos/scalableminds/webknossos/pulls/3135"}}},"pull_request":{"url":"https://api.github.com/repos/scalableminds/webknossos/pulls/3135","id":212108717,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEyMTA4NzE3","html_url":"https://github.com/scalableminds/webknossos/pull/3135","diff_url":"https://github.com/scalableminds/webknossos/pull/3135.diff","patch_url":"https://github.com/scalableminds/webknossos/pull/3135.patch","issue_url":"https://api.github.com/repos/scalableminds/webknossos/issues/3135","number":3135,"state":"open","locked":false,"title":"Diff schema","user":{"login":"rschwanhold","id":22892968,"node_id":"MDQ6VXNlcjIyODkyOTY4","avatar_url":"https://avatars3.githubusercontent.com/u/22892968?v=4","gravatar_id":"","url":"https://api.github.com/users/rschwanhold","html_url":"https://github.com/rschwanhold","followers_url":"https://api.github.com/users/rschwanhold/followers","following_url":"https://api.github.com/users/rschwanhold/following{/other_user}","gists_url":"https://api.github.com/users/rschwanhold/gists{/gist_id}","starred_url":"https://api.github.com/users/rschwanhold/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rschwanhold/subscriptions","organizations_url":"https://api.github.com/users/rschwanhold/orgs","repos_url":"https://api.github.com/users/rschwanhold/repos","events_url":"https://api.github.com/users/rschwanhold/events{/privacy}","received_events_url":"https://api.github.com/users/rschwanhold/received_events","type":"User","site_admin":false},"body":"### Steps to test:\r\n- edit/remove an evolution\r\n- add a new attibute to the DB and call the script with `DB` as parameter\r\n\r\n### Issues:\r\n- fixes #2779 \r\n\r\n------\r\n- ~~[ ] Updated [changelog](../blob/master/CHANGELOG.md#unreleased)~~\r\n- ~~[ ] Updated [migration guide](../blob/master/MIGRATIONS.md#unreleased) if applicable~~\r\n- ~~[ ] Updated [documentation](../blob/master/docs) if applicable~~\r\n- ~~[ ] Needs datastore update after deployment~~\r\n- [x] Ready for review\r\n","created_at":"2018-08-30T14:54:07Z","updated_at":"2018-09-04T15:31:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7445b4b5ae1ab895d58806ab82d460e612e26c33","assignee":{"login":"rschwanhold","id":22892968,"node_id":"MDQ6VXNlcjIyODkyOTY4","avatar_url":"https://avatars3.githubusercontent.com/u/22892968?v=4","gravatar_id":"","url":"https://api.github.com/users/rschwanhold","html_url":"https://github.com/rschwanhold","followers_url":"https://api.github.com/users/rschwanhold/followers","following_url":"https://api.github.com/users/rschwanhold/following{/other_user}","gists_url":"https://api.github.com/users/rschwanhold/gists{/gist_id}","starred_url":"https://api.github.com/users/rschwanhold/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rschwanhold/subscriptions","organizations_url":"https://api.github.com/users/rschwanhold/orgs","repos_url":"https://api.github.com/users/rschwanhold/repos","events_url":"https://api.github.com/users/rschwanhold/events{/privacy}","received_events_url":"https://api.github.com/users/rschwanhold/received_events","type":"User","site_admin":false},"assignees":[{"login":"rschwanhold","id":22892968,"node_id":"MDQ6VXNlcjIyODkyOTY4","avatar_url":"https://avatars3.githubusercontent.com/u/22892968?v=4","gravatar_id":"","url":"https://api.github.com/users/rschwanhold","html_url":"https://github.com/rschwanhold","followers_url":"https://api.github.com/users/rschwanhold/followers","following_url":"https://api.github.com/users/rschwanhold/following{/other_user}","gists_url":"https://api.github.com/users/rschwanhold/gists{/gist_id}","starred_url":"https://api.github.com/users/rschwanhold/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rschwanhold/subscriptions","organizations_url":"https://api.github.com/users/rschwanhold/orgs","repos_url":"https://api.github.com/users/rschwanhold/repos","events_url":"https://api.github.com/users/rschwanhold/events{/privacy}","received_events_url":"https://api.github.com/users/rschwanhold/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/scalableminds/webknossos/pulls/3135/commits","review_comments_url":"https://api.github.com/repos/scalableminds/webknossos/pulls/3135/comments","review_comment_url":"https://api.github.com/repos/scalableminds/webknossos/pulls/comments{/number}","comments_url":"https://api.github.com/repos/scalableminds/webknossos/issues/3135/comments","statuses_url":"https://api.github.com/repos/scalableminds/webknossos/statuses/8252e975255537440fb4ebc63e74cd83de8ad6d6","head":{"label":"scalableminds:diff-schema","ref":"diff-schema","sha":"8252e975255537440fb4ebc63e74cd83de8ad6d6","user":{"login":"scalableminds","id":1648557,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2NDg1NTc=","avatar_url":"https://avatars1.githubusercontent.com/u/1648557?v=4","gravatar_id":"","url":"https://api.github.com/users/scalableminds","html_url":"https://github.com/scalableminds","followers_url":"https://api.github.com/users/scalableminds/followers","following_url":"https://api.github.com/users/scalableminds/following{/other_user}","gists_url":"https://api.github.com/users/scalableminds/gists{/gist_id}","starred_url":"https://api.github.com/users/scalableminds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scalableminds/subscriptions","organizations_url":"https://api.github.com/users/scalableminds/orgs","repos_url":"https://api.github.com/users/scalableminds/repos","events_url":"https://api.github.com/users/scalableminds/events{/privacy}","received_events_url":"https://api.github.com/users/scalableminds/received_events","type":"Organization","site_admin":false},"repo":{"id":4326197,"node_id":"MDEwOlJlcG9zaXRvcnk0MzI2MTk3","name":"webknossos","full_name":"scalableminds/webknossos","owner":{"login":"scalableminds","id":1648557,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2NDg1NTc=","avatar_url":"https://avatars1.githubusercontent.com/u/1648557?v=4","gravatar_id":"","url":"https://api.github.com/users/scalableminds","html_url":"https://github.com/scalableminds","followers_url":"https://api.github.com/users/scalableminds/followers","following_url":"https://api.github.com/users/scalableminds/following{/other_user}","gists_url":"https://api.github.com/users/scalableminds/gists{/gist_id}","starred_url":"https://api.github.com/users/scalableminds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scalableminds/subscriptions","organizations_url":"https://api.github.com/users/scalableminds/orgs","repos_url":"https://api.github.com/users/scalableminds/repos","events_url":"https://api.github.com/users/scalableminds/events{/privacy}","received_events_url":"https://api.github.com/users/scalableminds/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scalableminds/webknossos","description":"A fully cloud- and browser-based 3D annotation tool for distributed large-scale data analysis in light- and electron-microscopy based Connectomics","fork":false,"url":"https://api.github.com/repos/scalableminds/webknossos","forks_url":"https://api.github.com/repos/scalableminds/webknossos/forks","keys_url":"https://api.github.com/repos/scalableminds/webknossos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scalableminds/webknossos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scalableminds/webknossos/teams","hooks_url":"https://api.github.com/repos/scalableminds/webknossos/hooks","issue_events_url":"https://api.github.com/repos/scalableminds/webknossos/issues/events{/number}","events_url":"https://api.github.com/repos/scalableminds/webknossos/events","assignees_url":"https://api.github.com/repos/scalableminds/webknossos/assignees{/user}","branches_url":"https://api.github.com/repos/scalableminds/webknossos/branches{/branch}","tags_url":"https://api.github.com/repos/scalableminds/webknossos/tags","blobs_url":"https://api.github.com/repos/scalableminds/webknossos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scalableminds/webknossos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scalableminds/webknossos/git/refs{/sha}","trees_url":"https://api.github.com/repos/scalableminds/webknossos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scalableminds/webknossos/statuses/{sha}","languages_url":"https://api.github.com/repos/scalableminds/webknossos/languages","stargazers_url":"https://api.github.com/repos/scalableminds/webknossos/stargazers","contributors_url":"https://api.github.com/repos/scalableminds/webknossos/contributors","subscribers_url":"https://api.github.com/repos/scalableminds/webknossos/subscribers","subscription_url":"https://api.github.com/repos/scalableminds/webknossos/subscription","commits_url":"https://api.github.com/repos/scalableminds/webknossos/commits{/sha}","git_commits_url":"https://api.github.com/repos/scalableminds/webknossos/git/commits{/sha}","comments_url":"https://api.github.com/repos/scalableminds/webknossos/comments{/number}","issue_comment_url":"https://api.github.com/repos/scalableminds/webknossos/issues/comments{/number}","contents_url":"https://api.github.com/repos/scalableminds/webknossos/contents/{+path}","compare_url":"https://api.github.com/repos/scalableminds/webknossos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scalableminds/webknossos/merges","archive_url":"https://api.github.com/repos/scalableminds/webknossos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scalableminds/webknossos/downloads","issues_url":"https://api.github.com/repos/scalableminds/webknossos/issues{/number}","pulls_url":"https://api.github.com/repos/scalableminds/webknossos/pulls{/number}","milestones_url":"https://api.github.com/repos/scalableminds/webknossos/milestones{/number}","notifications_url":"https://api.github.com/repos/scalableminds/webknossos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scalableminds/webknossos/labels{/name}","releases_url":"https://api.github.com/repos/scalableminds/webknossos/releases{/id}","deployments_url":"https://api.github.com/repos/scalableminds/webknossos/deployments","created_at":"2012-05-14T16:26:17Z","updated_at":"2018-09-03T12:19:01Z","pushed_at":"2018-09-04T15:13:11Z","git_url":"git://github.com/scalableminds/webknossos.git","ssh_url":"git@github.com:scalableminds/webknossos.git","clone_url":"https://github.com/scalableminds/webknossos.git","svn_url":"https://github.com/scalableminds/webknossos","homepage":"https://webknossos.org/","size":137834,"stargazers_count":22,"watchers_count":22,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":76,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":5,"open_issues":76,"watchers":22,"default_branch":"master"}},"base":{"label":"scalableminds:master","ref":"master","sha":"cedb4d90c479a32d3288e1c5af4e9f7005dd2ca4","user":{"login":"scalableminds","id":1648557,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2NDg1NTc=","avatar_url":"https://avatars1.githubusercontent.com/u/1648557?v=4","gravatar_id":"","url":"https://api.github.com/users/scalableminds","html_url":"https://github.com/scalableminds","followers_url":"https://api.github.com/users/scalableminds/followers","following_url":"https://api.github.com/users/scalableminds/following{/other_user}","gists_url":"https://api.github.com/users/scalableminds/gists{/gist_id}","starred_url":"https://api.github.com/users/scalableminds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scalableminds/subscriptions","organizations_url":"https://api.github.com/users/scalableminds/orgs","repos_url":"https://api.github.com/users/scalableminds/repos","events_url":"https://api.github.com/users/scalableminds/events{/privacy}","received_events_url":"https://api.github.com/users/scalableminds/received_events","type":"Organization","site_admin":false},"repo":{"id":4326197,"node_id":"MDEwOlJlcG9zaXRvcnk0MzI2MTk3","name":"webknossos","full_name":"scalableminds/webknossos","owner":{"login":"scalableminds","id":1648557,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2NDg1NTc=","avatar_url":"https://avatars1.githubusercontent.com/u/1648557?v=4","gravatar_id":"","url":"https://api.github.com/users/scalableminds","html_url":"https://github.com/scalableminds","followers_url":"https://api.github.com/users/scalableminds/followers","following_url":"https://api.github.com/users/scalableminds/following{/other_user}","gists_url":"https://api.github.com/users/scalableminds/gists{/gist_id}","starred_url":"https://api.github.com/users/scalableminds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scalableminds/subscriptions","organizations_url":"https://api.github.com/users/scalableminds/orgs","repos_url":"https://api.github.com/users/scalableminds/repos","events_url":"https://api.github.com/users/scalableminds/events{/privacy}","received_events_url":"https://api.github.com/users/scalableminds/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scalableminds/webknossos","description":"A fully cloud- and browser-based 3D annotation tool for distributed large-scale data analysis in light- and electron-microscopy based Connectomics","fork":false,"url":"https://api.github.com/repos/scalableminds/webknossos","forks_url":"https://api.github.com/repos/scalableminds/webknossos/forks","keys_url":"https://api.github.com/repos/scalableminds/webknossos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scalableminds/webknossos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scalableminds/webknossos/teams","hooks_url":"https://api.github.com/repos/scalableminds/webknossos/hooks","issue_events_url":"https://api.github.com/repos/scalableminds/webknossos/issues/events{/number}","events_url":"https://api.github.com/repos/scalableminds/webknossos/events","assignees_url":"https://api.github.com/repos/scalableminds/webknossos/assignees{/user}","branches_url":"https://api.github.com/repos/scalableminds/webknossos/branches{/branch}","tags_url":"https://api.github.com/repos/scalableminds/webknossos/tags","blobs_url":"https://api.github.com/repos/scalableminds/webknossos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scalableminds/webknossos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scalableminds/webknossos/git/refs{/sha}","trees_url":"https://api.github.com/repos/scalableminds/webknossos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scalableminds/webknossos/statuses/{sha}","languages_url":"https://api.github.com/repos/scalableminds/webknossos/languages","stargazers_url":"https://api.github.com/repos/scalableminds/webknossos/stargazers","contributors_url":"https://api.github.com/repos/scalableminds/webknossos/contributors","subscribers_url":"https://api.github.com/repos/scalableminds/webknossos/subscribers","subscription_url":"https://api.github.com/repos/scalableminds/webknossos/subscription","commits_url":"https://api.github.com/repos/scalableminds/webknossos/commits{/sha}","git_commits_url":"https://api.github.com/repos/scalableminds/webknossos/git/commits{/sha}","comments_url":"https://api.github.com/repos/scalableminds/webknossos/comments{/number}","issue_comment_url":"https://api.github.com/repos/scalableminds/webknossos/issues/comments{/number}","contents_url":"https://api.github.com/repos/scalableminds/webknossos/contents/{+path}","compare_url":"https://api.github.com/repos/scalableminds/webknossos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scalableminds/webknossos/merges","archive_url":"https://api.github.com/repos/scalableminds/webknossos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scalableminds/webknossos/downloads","issues_url":"https://api.github.com/repos/scalableminds/webknossos/issues{/number}","pulls_url":"https://api.github.com/repos/scalableminds/webknossos/pulls{/number}","milestones_url":"https://api.github.com/repos/scalableminds/webknossos/milestones{/number}","notifications_url":"https://api.github.com/repos/scalableminds/webknossos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scalableminds/webknossos/labels{/name}","releases_url":"https://api.github.com/repos/scalableminds/webknossos/releases{/id}","deployments_url":"https://api.github.com/repos/scalableminds/webknossos/deployments","created_at":"2012-05-14T16:26:17Z","updated_at":"2018-09-03T12:19:01Z","pushed_at":"2018-09-04T15:13:11Z","git_url":"git://github.com/scalableminds/webknossos.git","ssh_url":"git@github.com:scalableminds/webknossos.git","clone_url":"https://github.com/scalableminds/webknossos.git","svn_url":"https://github.com/scalableminds/webknossos","homepage":"https://webknossos.org/","size":137834,"stargazers_count":22,"watchers_count":22,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":76,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":5,"open_issues":76,"watchers":22,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scalableminds/webknossos/pulls/3135"},"html":{"href":"https://github.com/scalableminds/webknossos/pull/3135"},"issue":{"href":"https://api.github.com/repos/scalableminds/webknossos/issues/3135"},"comments":{"href":"https://api.github.com/repos/scalableminds/webknossos/issues/3135/comments"},"review_comments":{"href":"https://api.github.com/repos/scalableminds/webknossos/pulls/3135/comments"},"review_comment":{"href":"https://api.github.com/repos/scalableminds/webknossos/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/scalableminds/webknossos/pulls/3135/commits"},"statuses":{"href":"https://api.github.com/repos/scalableminds/webknossos/statuses/8252e975255537440fb4ebc63e74cd83de8ad6d6"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"normanrz"}}