diff --git a/db/migrate/20240207191223_remove_entitlement_mode_host_statuses.rb b/db/migrate/20240207191223_remove_entitlement_mode_host_statuses.rb index 349e09fc405..016dd7fdfd8 100644 --- a/db/migrate/20240207191223_remove_entitlement_mode_host_statuses.rb +++ b/db/migrate/20240207191223_remove_entitlement_mode_host_statuses.rb @@ -1,4 +1,9 @@ class RemoveEntitlementModeHostStatuses < ActiveRecord::Migration[6.1] + class FakeTablePreference < ApplicationRecord + self.table_name = 'table_preferences' + serialize :columns + end + def up obsolete_statuses = [ "Katello::SubscriptionStatus", @@ -11,7 +16,7 @@ def up ::HostStatus::Status.where(type: obsolete_statuses).delete_all - ::TablePreference.where(name: "hosts").each do |table_preference| + FakeTablePreference.where(name: "hosts").each do |table_preference| next unless table_preference.columns.include?("subscription_status") new_columns = table_preference.columns - ["subscription_status"] if new_columns.present?