{"action":"created","comment":{"url":"https://api.github.com/repos/OSGP/Platform/pulls/comments/138844099","pull_request_review_id":62681343,"id":138844099,"diff_hunk":"@@ -0,0 +1,73 @@\n+DO\n+$$\n+BEGIN\n+\t\n+  IF NOT EXISTS(SELECT 1 FROM information_schema.columns WHERE table_schema = current_schema AND table_name = 'device' AND column_name = 'device_lifecycle_status')\n+  THEN\n+  \tALTER TABLE device ADD COLUMN device_lifecycle_status VARCHAR(255);\n+  \tALTER TABLE device ALTER COLUMN device_lifecycle_status SET DEFAULT 'NEW_IN_INVENTORY';\n+  \t\n+  \t\n+  \t-- Migrating publiclighting devices to appropriate device lifecycle status --\n+  \t-- A public lighting device without a device_type is not yet registered with the platform, and therefor gets the status NEW_IN_INVENTORY --\n+  \tUPDATE device SET device_lifecycle_status = 'NEW_IN_INVENTORY' \n+  \tWHERE (device.device_type = 'SSLD' OR device.device_type = 'LMD' OR device.device_type = 'PSLD' OR device.device_type IS NULL)\n+  \tAND device.is_active = false \n+  \tAND device.is_activated = false \n+  \tAND device.technical_installation_date IS NULL;\n+\n+  \t-- Once a device is registered, it's device_type can not be null anymore --\n+  \tUPDATE device SET device_lifecycle_status = 'REGISTERED' \n+   \tWHERE (device.device_type = 'SSLD' OR device.device_type = 'LMD' OR device.device_type = 'PSLD')\n+  \tAND device.is_active = true \n+  \tAND device.is_activated = true \n+  \tAND device.technical_installation_date IS NULL;\n+  \t\n+  \tUPDATE device SET device_lifecycle_status = 'IN_USE'\n+  \tWHERE (device.device_type = 'SSLD' OR device.device_type = 'LMD' OR device.device_type = 'PSLD')\n+  \tAND device.is_active = true \n+  \tAND device.is_activated = true \n+  \tAND device.technical_installation_date IS NOT NULL;\n+  \t\n+  \tUPDATE device SET device_lifecycle_status = 'DESTROYED' \n+  \tWHERE (device.device_type = 'SSLD' OR device.device_type = 'LMD' OR device.device_type = 'PSLD')\n+  \tAND device.is_active = false \n+  \tAND device.is_activated = false \n+  \tAND device.technical_installation_date IS NOT NULL;\n+  \n+  \t-- Migrating rtu devices to appropriate device lifecycle status--\n+  \tUPDATE device SET device_lifecycle_status = 'IN_USE' \n+  \tWHERE device.device_type = 'RTU' \n+  \tAND device.is_active = true \n+  \tAND device.is_activated = true; \n+  \t\n+  \tUPDATE device SET device_lifecycle_status = 'READY_FOR_USE' \n+  \tWHERE device.device_type = 'RTU' \n+  \tAND device.is_active = false \n+  \tAND device.is_activated = false;\n+  \t\n+  \t-- Migrating smartmetering devices to appropriate device lifecycle status--\n+  \tUPDATE device SET device_lifecycle_status = 'DESTROYED' \n+  \tWHERE (device.device_type = 'SMART_METER_E' OR device.device_type = 'SMART_METER_G')\n+  \tAND device.is_active = false \n+  \tAND device.is_activated = false;\n+  \t\n+  \tUPDATE device SET device_lifecycle_status = 'IN_USE' \n+  \tWHERE (device.device_type = 'SMART_METER_E' OR device.device_type = 'SMART_METER_G')\n+  \tAND device.is_active = true \n+  \tAND device.is_activated = true;","path":"osgp-core/src/main/resources/db/migration/V20170830153714123__adds_device_status_for_all_value_streams.sql","position":58,"original_position":58,"commit_id":"2c97da0fa00c951eb75d83e93a569d94361f7c21","original_commit_id":"2c97da0fa00c951eb75d83e93a569d94361f7c21","user":{"login":"robindenadel","id":15684772,"avatar_url":"https://avatars2.githubusercontent.com/u/15684772?v=4","gravatar_id":"","url":"https://api.github.com/users/robindenadel","html_url":"https://github.com/robindenadel","followers_url":"https://api.github.com/users/robindenadel/followers","following_url":"https://api.github.com/users/robindenadel/following{/other_user}","gists_url":"https://api.github.com/users/robindenadel/gists{/gist_id}","starred_url":"https://api.github.com/users/robindenadel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/robindenadel/subscriptions","organizations_url":"https://api.github.com/users/robindenadel/orgs","repos_url":"https://api.github.com/users/robindenadel/repos","events_url":"https://api.github.com/users/robindenadel/events{/privacy}","received_events_url":"https://api.github.com/users/robindenadel/received_events","type":"User","site_admin":false},"body":"don't check is_activated for smart meters","created_at":"2017-09-14T09:38:44Z","updated_at":"2017-09-14T09:59:21Z","html_url":"https://github.com/OSGP/Platform/pull/642#discussion_r138844099","pull_request_url":"https://api.github.com/repos/OSGP/Platform/pulls/642","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/OSGP/Platform/pulls/comments/138844099"},"html":{"href":"https://github.com/OSGP/Platform/pull/642#discussion_r138844099"},"pull_request":{"href":"https://api.github.com/repos/OSGP/Platform/pulls/642"}}},"pull_request":{"url":"https://api.github.com/repos/OSGP/Platform/pulls/642","id":140331548,"html_url":"https://github.com/OSGP/Platform/pull/642","diff_url":"https://github.com/OSGP/Platform/pull/642.diff","patch_url":"https://github.com/OSGP/Platform/pull/642.patch","issue_url":"https://api.github.com/repos/OSGP/Platform/issues/642","number":642,"state":"open","locked":false,"title":"OC-359_Create_a_core_webmethod_to_change_the_status_of_a_device","user":{"login":"riannefijn","id":17719422,"avatar_url":"https://avatars1.githubusercontent.com/u/17719422?v=4","gravatar_id":"","url":"https://api.github.com/users/riannefijn","html_url":"https://github.com/riannefijn","followers_url":"https://api.github.com/users/riannefijn/followers","following_url":"https://api.github.com/users/riannefijn/following{/other_user}","gists_url":"https://api.github.com/users/riannefijn/gists{/gist_id}","starred_url":"https://api.github.com/users/riannefijn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/riannefijn/subscriptions","organizations_url":"https://api.github.com/users/riannefijn/orgs","repos_url":"https://api.github.com/users/riannefijn/repos","events_url":"https://api.github.com/users/riannefijn/events{/privacy}","received_events_url":"https://api.github.com/users/riannefijn/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-09-11T13:15:01Z","updated_at":"2017-09-14T09:59:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4140224a72b9e65c11fe696f51ed9f1ded89460d","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/OSGP/Platform/pulls/642/commits","review_comments_url":"https://api.github.com/repos/OSGP/Platform/pulls/642/comments","review_comment_url":"https://api.github.com/repos/OSGP/Platform/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OSGP/Platform/issues/642/comments","statuses_url":"https://api.github.com/repos/OSGP/Platform/statuses/2c97da0fa00c951eb75d83e93a569d94361f7c21","head":{"label":"OSGP:OC-359_Create_a_core_webmethod_to_change_the_status_of_a_device","ref":"OC-359_Create_a_core_webmethod_to_change_the_status_of_a_device","sha":"2c97da0fa00c951eb75d83e93a569d94361f7c21","user":{"login":"OSGP","id":11352045,"avatar_url":"https://avatars0.githubusercontent.com/u/11352045?v=4","gravatar_id":"","url":"https://api.github.com/users/OSGP","html_url":"https://github.com/OSGP","followers_url":"https://api.github.com/users/OSGP/followers","following_url":"https://api.github.com/users/OSGP/following{/other_user}","gists_url":"https://api.github.com/users/OSGP/gists{/gist_id}","starred_url":"https://api.github.com/users/OSGP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OSGP/subscriptions","organizations_url":"https://api.github.com/users/OSGP/orgs","repos_url":"https://api.github.com/users/OSGP/repos","events_url":"https://api.github.com/users/OSGP/events{/privacy}","received_events_url":"https://api.github.com/users/OSGP/received_events","type":"Organization","site_admin":false},"repo":{"id":32739388,"name":"Platform","full_name":"OSGP/Platform","owner":{"login":"OSGP","id":11352045,"avatar_url":"https://avatars0.githubusercontent.com/u/11352045?v=4","gravatar_id":"","url":"https://api.github.com/users/OSGP","html_url":"https://github.com/OSGP","followers_url":"https://api.github.com/users/OSGP/followers","following_url":"https://api.github.com/users/OSGP/following{/other_user}","gists_url":"https://api.github.com/users/OSGP/gists{/gist_id}","starred_url":"https://api.github.com/users/OSGP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OSGP/subscriptions","organizations_url":"https://api.github.com/users/OSGP/orgs","repos_url":"https://api.github.com/users/OSGP/repos","events_url":"https://api.github.com/users/OSGP/events{/privacy}","received_events_url":"https://api.github.com/users/OSGP/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OSGP/Platform","description":"The main components of OSGP.","fork":false,"url":"https://api.github.com/repos/OSGP/Platform","forks_url":"https://api.github.com/repos/OSGP/Platform/forks","keys_url":"https://api.github.com/repos/OSGP/Platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OSGP/Platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OSGP/Platform/teams","hooks_url":"https://api.github.com/repos/OSGP/Platform/hooks","issue_events_url":"https://api.github.com/repos/OSGP/Platform/issues/events{/number}","events_url":"https://api.github.com/repos/OSGP/Platform/events","assignees_url":"https://api.github.com/repos/OSGP/Platform/assignees{/user}","branches_url":"https://api.github.com/repos/OSGP/Platform/branches{/branch}","tags_url":"https://api.github.com/repos/OSGP/Platform/tags","blobs_url":"https://api.github.com/repos/OSGP/Platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OSGP/Platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OSGP/Platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/OSGP/Platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OSGP/Platform/statuses/{sha}","languages_url":"https://api.github.com/repos/OSGP/Platform/languages","stargazers_url":"https://api.github.com/repos/OSGP/Platform/stargazers","contributors_url":"https://api.github.com/repos/OSGP/Platform/contributors","subscribers_url":"https://api.github.com/repos/OSGP/Platform/subscribers","subscription_url":"https://api.github.com/repos/OSGP/Platform/subscription","commits_url":"https://api.github.com/repos/OSGP/Platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/OSGP/Platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/OSGP/Platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/OSGP/Platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/OSGP/Platform/contents/{+path}","compare_url":"https://api.github.com/repos/OSGP/Platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OSGP/Platform/merges","archive_url":"https://api.github.com/repos/OSGP/Platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OSGP/Platform/downloads","issues_url":"https://api.github.com/repos/OSGP/Platform/issues{/number}","pulls_url":"https://api.github.com/repos/OSGP/Platform/pulls{/number}","milestones_url":"https://api.github.com/repos/OSGP/Platform/milestones{/number}","notifications_url":"https://api.github.com/repos/OSGP/Platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OSGP/Platform/labels{/name}","releases_url":"https://api.github.com/repos/OSGP/Platform/releases{/id}","deployments_url":"https://api.github.com/repos/OSGP/Platform/deployments","created_at":"2015-03-23T15:05:40Z","updated_at":"2017-08-30T17:36:50Z","pushed_at":"2017-09-13T14:32:41Z","git_url":"git://github.com/OSGP/Platform.git","ssh_url":"git@github.com:OSGP/Platform.git","clone_url":"https://github.com/OSGP/Platform.git","svn_url":"https://github.com/OSGP/Platform","homepage":"http://www.opensmartgridplatform.org/","size":30030,"stargazers_count":25,"watchers_count":25,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":1,"forks":8,"open_issues":1,"watchers":25,"default_branch":"development"}},"base":{"label":"OSGP:development","ref":"development","sha":"47e39770edc34278da53d7964bf33e2c28b2157f","user":{"login":"OSGP","id":11352045,"avatar_url":"https://avatars0.githubusercontent.com/u/11352045?v=4","gravatar_id":"","url":"https://api.github.com/users/OSGP","html_url":"https://github.com/OSGP","followers_url":"https://api.github.com/users/OSGP/followers","following_url":"https://api.github.com/users/OSGP/following{/other_user}","gists_url":"https://api.github.com/users/OSGP/gists{/gist_id}","starred_url":"https://api.github.com/users/OSGP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OSGP/subscriptions","organizations_url":"https://api.github.com/users/OSGP/orgs","repos_url":"https://api.github.com/users/OSGP/repos","events_url":"https://api.github.com/users/OSGP/events{/privacy}","received_events_url":"https://api.github.com/users/OSGP/received_events","type":"Organization","site_admin":false},"repo":{"id":32739388,"name":"Platform","full_name":"OSGP/Platform","owner":{"login":"OSGP","id":11352045,"avatar_url":"https://avatars0.githubusercontent.com/u/11352045?v=4","gravatar_id":"","url":"https://api.github.com/users/OSGP","html_url":"https://github.com/OSGP","followers_url":"https://api.github.com/users/OSGP/followers","following_url":"https://api.github.com/users/OSGP/following{/other_user}","gists_url":"https://api.github.com/users/OSGP/gists{/gist_id}","starred_url":"https://api.github.com/users/OSGP/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OSGP/subscriptions","organizations_url":"https://api.github.com/users/OSGP/orgs","repos_url":"https://api.github.com/users/OSGP/repos","events_url":"https://api.github.com/users/OSGP/events{/privacy}","received_events_url":"https://api.github.com/users/OSGP/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OSGP/Platform","description":"The main components of OSGP.","fork":false,"url":"https://api.github.com/repos/OSGP/Platform","forks_url":"https://api.github.com/repos/OSGP/Platform/forks","keys_url":"https://api.github.com/repos/OSGP/Platform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OSGP/Platform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OSGP/Platform/teams","hooks_url":"https://api.github.com/repos/OSGP/Platform/hooks","issue_events_url":"https://api.github.com/repos/OSGP/Platform/issues/events{/number}","events_url":"https://api.github.com/repos/OSGP/Platform/events","assignees_url":"https://api.github.com/repos/OSGP/Platform/assignees{/user}","branches_url":"https://api.github.com/repos/OSGP/Platform/branches{/branch}","tags_url":"https://api.github.com/repos/OSGP/Platform/tags","blobs_url":"https://api.github.com/repos/OSGP/Platform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OSGP/Platform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OSGP/Platform/git/refs{/sha}","trees_url":"https://api.github.com/repos/OSGP/Platform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OSGP/Platform/statuses/{sha}","languages_url":"https://api.github.com/repos/OSGP/Platform/languages","stargazers_url":"https://api.github.com/repos/OSGP/Platform/stargazers","contributors_url":"https://api.github.com/repos/OSGP/Platform/contributors","subscribers_url":"https://api.github.com/repos/OSGP/Platform/subscribers","subscription_url":"https://api.github.com/repos/OSGP/Platform/subscription","commits_url":"https://api.github.com/repos/OSGP/Platform/commits{/sha}","git_commits_url":"https://api.github.com/repos/OSGP/Platform/git/commits{/sha}","comments_url":"https://api.github.com/repos/OSGP/Platform/comments{/number}","issue_comment_url":"https://api.github.com/repos/OSGP/Platform/issues/comments{/number}","contents_url":"https://api.github.com/repos/OSGP/Platform/contents/{+path}","compare_url":"https://api.github.com/repos/OSGP/Platform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OSGP/Platform/merges","archive_url":"https://api.github.com/repos/OSGP/Platform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OSGP/Platform/downloads","issues_url":"https://api.github.com/repos/OSGP/Platform/issues{/number}","pulls_url":"https://api.github.com/repos/OSGP/Platform/pulls{/number}","milestones_url":"https://api.github.com/repos/OSGP/Platform/milestones{/number}","notifications_url":"https://api.github.com/repos/OSGP/Platform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OSGP/Platform/labels{/name}","releases_url":"https://api.github.com/repos/OSGP/Platform/releases{/id}","deployments_url":"https://api.github.com/repos/OSGP/Platform/deployments","created_at":"2015-03-23T15:05:40Z","updated_at":"2017-08-30T17:36:50Z","pushed_at":"2017-09-13T14:32:41Z","git_url":"git://github.com/OSGP/Platform.git","ssh_url":"git@github.com:OSGP/Platform.git","clone_url":"https://github.com/OSGP/Platform.git","svn_url":"https://github.com/OSGP/Platform","homepage":"http://www.opensmartgridplatform.org/","size":30030,"stargazers_count":25,"watchers_count":25,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":8,"mirror_url":null,"open_issues_count":1,"forks":8,"open_issues":1,"watchers":25,"default_branch":"development"}},"_links":{"self":{"href":"https://api.github.com/repos/OSGP/Platform/pulls/642"},"html":{"href":"https://github.com/OSGP/Platform/pull/642"},"issue":{"href":"https://api.github.com/repos/OSGP/Platform/issues/642"},"comments":{"href":"https://api.github.com/repos/OSGP/Platform/issues/642/comments"},"review_comments":{"href":"https://api.github.com/repos/OSGP/Platform/pulls/642/comments"},"review_comment":{"href":"https://api.github.com/repos/OSGP/Platform/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OSGP/Platform/pulls/642/commits"},"statuses":{"href":"https://api.github.com/repos/OSGP/Platform/statuses/2c97da0fa00c951eb75d83e93a569d94361f7c21"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"robindenadel"}}