From b3f3f577fc11cccf7d19c8bbe406e74b2a1a6402 Mon Sep 17 00:00:00 2001 From: Joe Rafaniello Date: Thu, 1 Aug 2019 16:16:00 -0400 Subject: [PATCH] Allow ovirt to implement their own pg version check This doesn't fix the following bug but allows them to implement their own adapter that opts-out of the manageiq pg version check and instead implement their own via a check_version, something like this: ```ruby module ActiveRecord module ConnectionHandling # :nodoc: def ovirt_postgresql_connection(config) conn_params = config.symbolize_keys ...rest of the existing rails 5.1 pg adapter method until... ConnectionAdapters::OvirtPostgreSQLAdapter.new(nil, logger, conn_params, config) end end module ConnectionAdapters class OvirtPostgreSQLAdapter < PostgreSQLAdapter def check_version raise "AAAAA" if postgresql_version > XXX end end end end ``` https://bugzilla.redhat.com/show_bug.cgi?id=1734770 --- config/initializers/postgres_required_versions.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/initializers/postgres_required_versions.rb b/config/initializers/postgres_required_versions.rb index df147471e23..1151fd969bb 100644 --- a/config/initializers/postgres_required_versions.rb +++ b/config/initializers/postgres_required_versions.rb @@ -1,7 +1,10 @@ ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.prepend Module.new { def initialize(*args) super + check_version if respond_to?(:check_version) + end + def check_version msg = "The version of PostgreSQL being connected to is incompatible with #{Vmdb::Appliance.PRODUCT_NAME} (10 required)" if postgresql_version < 90500