diff --git a/db/migrate/20211022193626_remove_migration_feature.rb b/db/migrate/20211022193626_remove_migration_feature.rb index e201ed3f3..0c1b5123f 100644 --- a/db/migrate/20211022193626_remove_migration_feature.rb +++ b/db/migrate/20211022193626_remove_migration_feature.rb @@ -1,4 +1,4 @@ -class RemoveMigrationFeature < ActiveRecord::Migration[5.2] +class RemoveMigrationFeature < ActiveRecord::Migration[6.0] class ServiceTemplate < ActiveRecord::Base self.inheritance_column = :_type_disabled end @@ -15,6 +15,10 @@ class Job < ActiveRecord::Base self.inheritance_column = :_type_disabled end + class ServiceOrder < ActiveRecord::Base + self.inheritance_column = :_type_disabled + end + class Vm < ActiveRecord::Base self.inheritance_column = :_type_disabled end @@ -27,13 +31,20 @@ class CustomAttribute < ActiveRecord::Base; end class Tag < ActiveRecord::Base; end class Tagging < ActiveRecord::Base; end + TRANSFORMATION_PLAN_CLASSES = %w[ + ServiceTemplateTransformationPlan + ManageIQ::Providers::Openstack::CloudManager::ServiceTemplateTransformationPlan + ManageIQ::Providers::Redhat::InfraManager::ServiceTemplateTransformationPlan + ] + def up # These classes inherit from core classes, so we don't drop the tables. # Instead we remove the records. - ServiceTemplate.where(:type => "ServiceTemplateTransformationPlan").delete_all + ServiceTemplate.where(:type => TRANSFORMATION_PLAN_CLASSES).delete_all MiqRequest.where(:type => "ServiceTemplateTransformationPlanRequest").delete_all MiqRequestTask.where(:type => "ServiceTemplateTransformationPlanTask").delete_all Job.where(:type => "InfraConversionJob").delete_all + ServiceOrder.where(:type => "ServiceOrderV2V").delete_all # Conversion hosts can be either a RHV host or VM, or an OpenStack VM # We need to clean the resources, i.e. remove tags and custom attributes diff --git a/spec/automated_review/column_documentation_spec.rb b/spec/automated_review/column_documentation_spec.rb index c776c104b..0a4535096 100644 --- a/spec/automated_review/column_documentation_spec.rb +++ b/spec/automated_review/column_documentation_spec.rb @@ -1,6 +1,6 @@ describe "Column documentation" do # Documented tables - %w[conversion_hosts miq_tasks].each do |table_name| + %w[miq_tasks].each do |table_name| it "#{table_name} columns are documented" do klass = Class.new(ActiveRecord::Base) do self.table_name = table_name diff --git a/spec/migrations/20211022193626_remove_migration_feature_spec.rb b/spec/migrations/20211022193626_remove_migration_feature_spec.rb index d675257a7..ef6f6b2c2 100644 --- a/spec/migrations/20211022193626_remove_migration_feature_spec.rb +++ b/spec/migrations/20211022193626_remove_migration_feature_spec.rb @@ -6,6 +6,7 @@ let(:miq_request) { migration_stub(:MiqRequest) } let(:miq_request_task) { migration_stub(:MiqRequestTask) } let(:job) { migration_stub(:Job) } + let(:service_order) { migration_stub(:ServiceOrder) } let(:conversion_host) { migration_stub(:ConversionHost) } let(:tag) { migration_stub(:Tag) } let(:tagging) { migration_stub(:Tagging) } @@ -16,6 +17,8 @@ it "cleans the database and removes the tables" do service_template.create!(:type => "ServiceTemplate") service_template.create!(:type => "ServiceTemplateTransformationPlan") + service_template.create!(:type => "ManageIQ::Providers::Openstack::CloudManager::ServiceTemplateTransformationPlan") + service_template.create!(:type => "ManageIQ::Providers::Redhat::InfraManager::ServiceTemplateTransformationPlan") miq_request.create!(:type => "MiqRequest") miq_request.create!(:type => "ServiceTemplateTransformationPlanRequest") @@ -26,6 +29,9 @@ job.create!(:type => "Job") job.create!(:type => "InfraConversionJob") + service_order.create!(:type => "ServiceOrder") + service_order.create!(:type => "ServiceOrderV2V") + tag_1 = tag.create!(:name => "/managed/v2v_transformation_host/false") tag_2 = tag.create!(:name => "/managed/v2v_transformation_host/true") tag_3 = tag.create!(:name => "/managed/v2v_transformation_method/vddk") @@ -57,6 +63,9 @@ expect(job.count).to eq(1) expect(job.first.type).to eq("Job") + expect(service_order.count).to eq(1) + expect(service_order.first.type).to eq("ServiceOrder") + expect(tag.count).to eq(1) expect(tag.first.name).to eq("/managed/stub/dummy") diff --git a/spec/support/table_list.txt b/spec/support/table_list.txt index 6fbbe8451..7bb36257d 100644 --- a/spec/support/table_list.txt +++ b/spec/support/table_list.txt @@ -75,7 +75,6 @@ container_template_parameters container_templates container_volumes containers -conversion_hosts currencies custom_attributes custom_buttons @@ -122,8 +121,8 @@ guest_devices hardwares host_aggregate_hosts host_aggregates -host_initiators host_initiator_groups +host_initiators host_service_groups host_storages host_switches @@ -326,8 +325,6 @@ tags tenant_quotas tenants time_profiles -transformation_mapping_items -transformation_mappings users vim_performance_operating_ranges vim_performance_states