DEV: Remove badge_granted_title column from user_profiles (#20476)

That column is obsolete since we added the `granted_title_badge_id` column in 2019 (56d3e29a698e704f647cf2e500d0d94d7d9e21bf). Having both columns can lead to inconsistencies (mostly due to old data from before 2019).

For example, `BadgeGranter.revoke_ungranted_titles!` doesn't work correctly if `badge_granted_title` is `false` while `granted_title_badge_id` points to the badge that is used as title.
This commit is contained in:
Gerhard Schlager
2023-03-08 13:37:20 +01:00
committed by GitHub
parent 5fb2c1dde5
commit 12436d054d
10 changed files with 33 additions and 36 deletions

View File

@ -0,0 +1,13 @@
# frozen_string_literal: true
class DropBadgeGrantedTitleColumn < ActiveRecord::Migration[7.0]
DROPPED_COLUMNS ||= { user_profiles: %i[badge_granted_title] }
def up
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
end
def down
raise ActiveRecord::IrreversibleMigration
end
end