mirror of
https://github.com/discourse/discourse.git
synced 2024-12-25 18:13:44 +08:00
7b437c9401
We're planning to implement a feature that allows adding required fields for existing users. This PR does some preparatory refactoring to make that possible. There should be no changes to existing behaviour. Just a small update to the admin UI.
18 lines
390 B
Ruby
18 lines
390 B
Ruby
# frozen_string_literal: true
|
|
|
|
class AddRequirementToUserFields < ActiveRecord::Migration[7.0]
|
|
def up
|
|
add_column :user_fields, :requirement, :integer, null: false, default: 0
|
|
|
|
execute <<~SQL
|
|
UPDATE user_fields
|
|
SET requirement =
|
|
(CASE WHEN required IS NOT TRUE THEN 0 ELSE 2 END)
|
|
SQL
|
|
end
|
|
|
|
def down
|
|
remove_column :user_fields, :requirement
|
|
end
|
|
end
|