Use AR database_version in PG version checks in migrations (#28804)
This commit is contained in:
@@ -20,8 +20,7 @@ class CopyStatusStats < ActiveRecord::Migration[5.2]
|
||||
private
|
||||
|
||||
def supports_upsert?
|
||||
version = select_one("SELECT current_setting('server_version_num') AS v")['v'].to_i
|
||||
version >= 90_500
|
||||
ActiveRecord::Base.connection.database_version >= 90_500
|
||||
end
|
||||
|
||||
def up_fast
|
||||
|
||||
@@ -24,8 +24,7 @@ class CopyAccountStats < ActiveRecord::Migration[5.2]
|
||||
private
|
||||
|
||||
def supports_upsert?
|
||||
version = select_one("SELECT current_setting('server_version_num') AS v")['v'].to_i
|
||||
version >= 90_500
|
||||
ActiveRecord::Base.connection.database_version >= 90_500
|
||||
end
|
||||
|
||||
def up_fast
|
||||
|
||||
@@ -17,8 +17,7 @@ class AddUniqueIndexOnPreviewCardsStatuses < ActiveRecord::Migration[6.1]
|
||||
|
||||
def supports_concurrent_reindex?
|
||||
@supports_concurrent_reindex ||= begin
|
||||
version = select_one("SELECT current_setting('server_version_num') AS v")['v'].to_i
|
||||
version >= 120_000
|
||||
ActiveRecord::Base.connection.database_version >= 120_000
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user