{"action":"created","comment":{"url":"https://api.github.com/repos/ManageIQ/manageiq-schema/pulls/comments/222037286","pull_request_review_id":160830028,"id":222037286,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMjAzNzI4Ng==","diff_hunk":"@@ -0,0 +1,46 @@\n+class AddConversionHostIdToMiqRequestTasks < ActiveRecord::Migration[5.0]\n+  class MiqRequestTask < ActiveRecord::Base\n+    self.inheritance_column = :_type_disabled\n+    serialize :options, Hash\n+    belongs_to :conversion_host, :class_name => \"AddConversionHostIdToMiqRequestTasks::ConversionHost\"\n+  end\n+\n+  class ConversionHost < ActiveRecord::Base\n+    self.inheritance_column = :_type_disabled\n+    belongs_to :resource, :polymorphic => true\n+  end\n+\n+  class Host < ActiveRecord::Base\n+    self.inheritance_column = :_type_disabled\n+  end\n+\n+  def up\n+    add_column :miq_request_tasks, :conversion_host_id, :bigint\n+\n+    MiqRequestTask.where(:type => 'ServiceTemplateTransformationPlanTask').each do |task|\n+      host_id = task.options[:transformation_host_id]\n+      next unless host_id\n+      host = Host.find_by(:id => host_id)\n+      task.options.delete(:transformation_host_id)\n+      if host.present?\n+        task.conversion_host = ConversionHost.find_or_create_by!(:resource => host) do |ch|\n+          ch.name                     = host.name\n+          ch.vddk_transport_supported = true\n+          ch.ssh_transport_supported  = false\n+        end\n+      end\n+      task.save!\n+    end\n+  end\n+\n+  def down\n+    conversion_host_ids = MiqRequestTask.where(:type => 'ServiceTemplateTransformationPlanTask').map do |task|\n+      task.options[:transformation_host_id] = task.conversion_host.resource.id","path":"db/migrate/20181001131632_add_conversion_host_id_to_miq_request_tasks.rb","position":38,"original_position":38,"commit_id":"f99b0406ba3495d15e4d61d5455558e3d3055f7b","original_commit_id":"f99b0406ba3495d15e4d61d5455558e3d3055f7b","user":{"login":"agrare","id":12851112,"node_id":"MDQ6VXNlcjEyODUxMTEy","avatar_url":"https://avatars2.githubusercontent.com/u/12851112?v=4","gravatar_id":"","url":"https://api.github.com/users/agrare","html_url":"https://github.com/agrare","followers_url":"https://api.github.com/users/agrare/followers","following_url":"https://api.github.com/users/agrare/following{/other_user}","gists_url":"https://api.github.com/users/agrare/gists{/gist_id}","starred_url":"https://api.github.com/users/agrare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agrare/subscriptions","organizations_url":"https://api.github.com/users/agrare/orgs","repos_url":"https://api.github.com/users/agrare/repos","events_url":"https://api.github.com/users/agrare/events{/privacy}","received_events_url":"https://api.github.com/users/agrare/received_events","type":"User","site_admin":false},"body":"If `task.conversion_host` is nil you should skip the rest of this","created_at":"2018-10-02T17:14:12Z","updated_at":"2018-10-02T17:14:12Z","html_url":"https://github.com/ManageIQ/manageiq-schema/pull/281#discussion_r222037286","pull_request_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/pulls/281","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/ManageIQ/manageiq-schema/pulls/comments/222037286"},"html":{"href":"https://github.com/ManageIQ/manageiq-schema/pull/281#discussion_r222037286"},"pull_request":{"href":"https://api.github.com/repos/ManageIQ/manageiq-schema/pulls/281"}}},"pull_request":{"url":"https://api.github.com/repos/ManageIQ/manageiq-schema/pulls/281","id":219374038,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE5Mzc0MDM4","html_url":"https://github.com/ManageIQ/manageiq-schema/pull/281","diff_url":"https://github.com/ManageIQ/manageiq-schema/pull/281.diff","patch_url":"https://github.com/ManageIQ/manageiq-schema/pull/281.patch","issue_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/issues/281","number":281,"state":"open","locked":false,"title":"Add conversion_host_id to miq_request_task","user":{"login":"fdupont-redhat","id":25821288,"node_id":"MDQ6VXNlcjI1ODIxMjg4","avatar_url":"https://avatars0.githubusercontent.com/u/25821288?v=4","gravatar_id":"","url":"https://api.github.com/users/fdupont-redhat","html_url":"https://github.com/fdupont-redhat","followers_url":"https://api.github.com/users/fdupont-redhat/followers","following_url":"https://api.github.com/users/fdupont-redhat/following{/other_user}","gists_url":"https://api.github.com/users/fdupont-redhat/gists{/gist_id}","starred_url":"https://api.github.com/users/fdupont-redhat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fdupont-redhat/subscriptions","organizations_url":"https://api.github.com/users/fdupont-redhat/orgs","repos_url":"https://api.github.com/users/fdupont-redhat/repos","events_url":"https://api.github.com/users/fdupont-redhat/events{/privacy}","received_events_url":"https://api.github.com/users/fdupont-redhat/received_events","type":"User","site_admin":false},"body":"The `ServiceTemplateTransformationPlanTask` class relies on a conversion host to actually run the migration. The conversion host is modeled in `ConversionHost` class. From a database point of view, the `ServiceTemplateTransformationPlanTask` class is stored in `miq_request_tasks` table, because it's a sub-sub-class of `MiqRequestTask`. This PR adds a `conversion_host_id` column to `miq_request_tasks` to set the relationship.\r\n\r\nAssociated RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1634029","created_at":"2018-10-01T13:22:51Z","updated_at":"2018-10-02T17:14:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8b670f2e6e2fdb7fe2f7bb0c9f73cf81c1ef65fd","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":736077080,"node_id":"MDU6TGFiZWw3MzYwNzcwODA=","url":"https://api.github.com/repos/ManageIQ/manageiq-schema/labels/gaprindashvili/no","name":"gaprindashvili/no","color":"555555","default":false},{"id":1069067888,"node_id":"MDU6TGFiZWwxMDY5MDY3ODg4","url":"https://api.github.com/repos/ManageIQ/manageiq-schema/labels/hammer/no","name":"hammer/no","color":"000000","default":false},{"id":654725933,"node_id":"MDU6TGFiZWw2NTQ3MjU5MzM=","url":"https://api.github.com/repos/ManageIQ/manageiq-schema/labels/schema","name":"schema","color":"5319e7","default":false},{"id":830463059,"node_id":"MDU6TGFiZWw4MzA0NjMwNTk=","url":"https://api.github.com/repos/ManageIQ/manageiq-schema/labels/transformation","name":"transformation","color":"5319e7","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/pulls/281/commits","review_comments_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/pulls/281/comments","review_comment_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/issues/281/comments","statuses_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/statuses/f99b0406ba3495d15e4d61d5455558e3d3055f7b","head":{"label":"fdupont-redhat:v2v_add_conversion_host_id_to_transformation_task","ref":"v2v_add_conversion_host_id_to_transformation_task","sha":"f99b0406ba3495d15e4d61d5455558e3d3055f7b","user":{"login":"fdupont-redhat","id":25821288,"node_id":"MDQ6VXNlcjI1ODIxMjg4","avatar_url":"https://avatars0.githubusercontent.com/u/25821288?v=4","gravatar_id":"","url":"https://api.github.com/users/fdupont-redhat","html_url":"https://github.com/fdupont-redhat","followers_url":"https://api.github.com/users/fdupont-redhat/followers","following_url":"https://api.github.com/users/fdupont-redhat/following{/other_user}","gists_url":"https://api.github.com/users/fdupont-redhat/gists{/gist_id}","starred_url":"https://api.github.com/users/fdupont-redhat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fdupont-redhat/subscriptions","organizations_url":"https://api.github.com/users/fdupont-redhat/orgs","repos_url":"https://api.github.com/users/fdupont-redhat/repos","events_url":"https://api.github.com/users/fdupont-redhat/events{/privacy}","received_events_url":"https://api.github.com/users/fdupont-redhat/received_events","type":"User","site_admin":false},"repo":{"id":149120172,"node_id":"MDEwOlJlcG9zaXRvcnkxNDkxMjAxNzI=","name":"manageiq-schema","full_name":"fdupont-redhat/manageiq-schema","private":false,"owner":{"login":"fdupont-redhat","id":25821288,"node_id":"MDQ6VXNlcjI1ODIxMjg4","avatar_url":"https://avatars0.githubusercontent.com/u/25821288?v=4","gravatar_id":"","url":"https://api.github.com/users/fdupont-redhat","html_url":"https://github.com/fdupont-redhat","followers_url":"https://api.github.com/users/fdupont-redhat/followers","following_url":"https://api.github.com/users/fdupont-redhat/following{/other_user}","gists_url":"https://api.github.com/users/fdupont-redhat/gists{/gist_id}","starred_url":"https://api.github.com/users/fdupont-redhat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fdupont-redhat/subscriptions","organizations_url":"https://api.github.com/users/fdupont-redhat/orgs","repos_url":"https://api.github.com/users/fdupont-redhat/repos","events_url":"https://api.github.com/users/fdupont-redhat/events{/privacy}","received_events_url":"https://api.github.com/users/fdupont-redhat/received_events","type":"User","site_admin":false},"html_url":"https://github.com/fdupont-redhat/manageiq-schema","description":"SQL schema and database migrations for ManageIQ","fork":true,"url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema","forks_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/forks","keys_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/teams","hooks_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/hooks","issue_events_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/issues/events{/number}","events_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/events","assignees_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/assignees{/user}","branches_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/branches{/branch}","tags_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/tags","blobs_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/git/refs{/sha}","trees_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/statuses/{sha}","languages_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/languages","stargazers_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/stargazers","contributors_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/contributors","subscribers_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/subscribers","subscription_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/subscription","commits_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/commits{/sha}","git_commits_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/git/commits{/sha}","comments_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/comments{/number}","issue_comment_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/issues/comments{/number}","contents_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/contents/{+path}","compare_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/merges","archive_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/downloads","issues_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/issues{/number}","pulls_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/pulls{/number}","milestones_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/milestones{/number}","notifications_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/labels{/name}","releases_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/releases{/id}","deployments_url":"https://api.github.com/repos/fdupont-redhat/manageiq-schema/deployments","created_at":"2018-09-17T12:14:50Z","updated_at":"2018-09-17T12:14:53Z","pushed_at":"2018-10-02T17:05:53Z","git_url":"git://github.com/fdupont-redhat/manageiq-schema.git","ssh_url":"git@github.com:fdupont-redhat/manageiq-schema.git","clone_url":"https://github.com/fdupont-redhat/manageiq-schema.git","svn_url":"https://github.com/fdupont-redhat/manageiq-schema","homepage":null,"size":3436,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ManageIQ:master","ref":"master","sha":"46cc3f254368ccab8a6ec68b99188b3fffd322ab","user":{"login":"ManageIQ","id":1125575,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExMjU1NzU=","avatar_url":"https://avatars0.githubusercontent.com/u/1125575?v=4","gravatar_id":"","url":"https://api.github.com/users/ManageIQ","html_url":"https://github.com/ManageIQ","followers_url":"https://api.github.com/users/ManageIQ/followers","following_url":"https://api.github.com/users/ManageIQ/following{/other_user}","gists_url":"https://api.github.com/users/ManageIQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ManageIQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManageIQ/subscriptions","organizations_url":"https://api.github.com/users/ManageIQ/orgs","repos_url":"https://api.github.com/users/ManageIQ/repos","events_url":"https://api.github.com/users/ManageIQ/events{/privacy}","received_events_url":"https://api.github.com/users/ManageIQ/received_events","type":"Organization","site_admin":false},"repo":{"id":90904181,"node_id":"MDEwOlJlcG9zaXRvcnk5MDkwNDE4MQ==","name":"manageiq-schema","full_name":"ManageIQ/manageiq-schema","private":false,"owner":{"login":"ManageIQ","id":1125575,"node_id":"MDEyOk9yZ2FuaXphdGlvbjExMjU1NzU=","avatar_url":"https://avatars0.githubusercontent.com/u/1125575?v=4","gravatar_id":"","url":"https://api.github.com/users/ManageIQ","html_url":"https://github.com/ManageIQ","followers_url":"https://api.github.com/users/ManageIQ/followers","following_url":"https://api.github.com/users/ManageIQ/following{/other_user}","gists_url":"https://api.github.com/users/ManageIQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ManageIQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManageIQ/subscriptions","organizations_url":"https://api.github.com/users/ManageIQ/orgs","repos_url":"https://api.github.com/users/ManageIQ/repos","events_url":"https://api.github.com/users/ManageIQ/events{/privacy}","received_events_url":"https://api.github.com/users/ManageIQ/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/ManageIQ/manageiq-schema","description":"SQL schema and database migrations for ManageIQ","fork":false,"url":"https://api.github.com/repos/ManageIQ/manageiq-schema","forks_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/forks","keys_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/teams","hooks_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/hooks","issue_events_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/issues/events{/number}","events_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/events","assignees_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/assignees{/user}","branches_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/branches{/branch}","tags_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/tags","blobs_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/git/refs{/sha}","trees_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/statuses/{sha}","languages_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/languages","stargazers_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/stargazers","contributors_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/contributors","subscribers_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/subscribers","subscription_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/subscription","commits_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/commits{/sha}","git_commits_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/git/commits{/sha}","comments_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/comments{/number}","issue_comment_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/issues/comments{/number}","contents_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/contents/{+path}","compare_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/merges","archive_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/downloads","issues_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/issues{/number}","pulls_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/pulls{/number}","milestones_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/milestones{/number}","notifications_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/labels{/name}","releases_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/releases{/id}","deployments_url":"https://api.github.com/repos/ManageIQ/manageiq-schema/deployments","created_at":"2017-05-10T20:11:26Z","updated_at":"2018-09-28T20:42:19Z","pushed_at":"2018-10-02T17:05:55Z","git_url":"git://github.com/ManageIQ/manageiq-schema.git","ssh_url":"git@github.com:ManageIQ/manageiq-schema.git","clone_url":"https://github.com/ManageIQ/manageiq-schema.git","svn_url":"https://github.com/ManageIQ/manageiq-schema","homepage":null,"size":3426,"stargazers_count":12,"watchers_count":12,"language":"Ruby","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":84,"mirror_url":null,"archived":false,"open_issues_count":17,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":84,"open_issues":17,"watchers":12,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ManageIQ/manageiq-schema/pulls/281"},"html":{"href":"https://github.com/ManageIQ/manageiq-schema/pull/281"},"issue":{"href":"https://api.github.com/repos/ManageIQ/manageiq-schema/issues/281"},"comments":{"href":"https://api.github.com/repos/ManageIQ/manageiq-schema/issues/281/comments"},"review_comments":{"href":"https://api.github.com/repos/ManageIQ/manageiq-schema/pulls/281/comments"},"review_comment":{"href":"https://api.github.com/repos/ManageIQ/manageiq-schema/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ManageIQ/manageiq-schema/pulls/281/commits"},"statuses":{"href":"https://api.github.com/repos/ManageIQ/manageiq-schema/statuses/f99b0406ba3495d15e4d61d5455558e3d3055f7b"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"agrare"}}