mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-25 07:05:20 +00:00
Use AR database_version
in PG version checks in migrations (#28804)
This commit is contained in:
parent
d0b3bc23d7
commit
f0b93ab02f
|
@ -20,8 +20,7 @@ class CopyStatusStats < ActiveRecord::Migration[5.2]
|
||||||
private
|
private
|
||||||
|
|
||||||
def supports_upsert?
|
def supports_upsert?
|
||||||
version = select_one("SELECT current_setting('server_version_num') AS v")['v'].to_i
|
ActiveRecord::Base.connection.database_version >= 90_500
|
||||||
version >= 90_500
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def up_fast
|
def up_fast
|
||||||
|
|
|
@ -24,8 +24,7 @@ class CopyAccountStats < ActiveRecord::Migration[5.2]
|
||||||
private
|
private
|
||||||
|
|
||||||
def supports_upsert?
|
def supports_upsert?
|
||||||
version = select_one("SELECT current_setting('server_version_num') AS v")['v'].to_i
|
ActiveRecord::Base.connection.database_version >= 90_500
|
||||||
version >= 90_500
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def up_fast
|
def up_fast
|
||||||
|
|
|
@ -17,8 +17,7 @@ class AddUniqueIndexOnPreviewCardsStatuses < ActiveRecord::Migration[6.1]
|
||||||
|
|
||||||
def supports_concurrent_reindex?
|
def supports_concurrent_reindex?
|
||||||
@supports_concurrent_reindex ||= begin
|
@supports_concurrent_reindex ||= begin
|
||||||
version = select_one("SELECT current_setting('server_version_num') AS v")['v'].to_i
|
ActiveRecord::Base.connection.database_version >= 120_000
|
||||||
version >= 120_000
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue