diff --git a/db/migrate/20240624121212_katello_recreate_evr_constructs.rb b/db/migrate/20240624121212_katello_recreate_evr_constructs.rb index 4cc31c0bb64..fb86ac88124 100644 --- a/db/migrate/20240624121212_katello_recreate_evr_constructs.rb +++ b/db/migrate/20240624121212_katello_recreate_evr_constructs.rb @@ -1,14 +1,9 @@ class KatelloRecreateEvrConstructs < ActiveRecord::Migration[6.1] - def change - count = select_value <<~SQL - SELECT count(*) FROM pg_extension WHERE extname = 'evr'; - SQL - if count.to_i == 0 + def up + if !extension_enabled?('evr') return else - execute <<~SQL - DROP EXTENSION evr CASCADE; - SQL + disable_extension('evr') execute <<~SQL create type evr_array_item as ( @@ -156,4 +151,8 @@ def change create_trigger :evr_update_trigger_katello_installed_packages, on: :katello_installed_packages end end + + def down + fail ActiveRecord::IrreversibleMigration + end end