DEV: Remove NULLS NOT DISTINCT from problem check trackers (#29327)

We added NULLS NOT DISTINCT to a unique index on problem_check_trackers.

This option is only available in PG15+. It does not in itself break PG13, but restoring a PG15+ backup to PG13 currently errors out. It seems this is an operation that's more common than we first thought.

This commit fixes that by removing the NULLS NOT DISTINCT.

We already have another, backwards-compatible approach to do the same thing in place, so this shouldn't change existing behaviour.
This commit is contained in:
Ted Johansson 2024-10-22 10:47:24 +08:00 committed by GitHub
parent 44c8470813
commit 63ed1b5bd7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -0,0 +1,12 @@
# frozen_string_literal: true
class RemoveNullsNotDistinctFromProblemCheckTrackers < ActiveRecord::Migration[7.1]
def up
remove_index :problem_check_trackers, %i[identifier target], if_exists: true
add_index :problem_check_trackers, %i[identifier target], unique: true
end
def down
remove_index :problem_check_trackers, %i[identifier target], if_exists: true
add_index :problem_check_trackers, %i[identifier target], unique: true, nulls_not_distinct: true
end
end