mirror of
https://github.com/discourse/discourse.git
synced 2025-06-05 14:07:30 +08:00
DEV: Replace old field_type text column with field_type_enum integer column (#27448)
Follow up to: #27444. In that PR we added a new integer column for UserField#field_type and populated the data based on the old text field. In this PR we drop the old text column and swap in the new integer (enum) column.
This commit is contained in:
@ -0,0 +1,14 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class SwapFieldTypeWithFieldTypeEnumOnUserFields < ActiveRecord::Migration[7.0]
|
||||
DROPPED_COLUMNS ||= { user_fields: %i[field_type] }
|
||||
|
||||
def up
|
||||
DROPPED_COLUMNS.each { |table, columns| Migration::ColumnDropper.execute_drop(table, columns) }
|
||||
rename_column :user_fields, :field_type_enum, :field_type
|
||||
end
|
||||
|
||||
def down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user