mirror of
https://github.com/discourse/discourse.git
synced 2024-12-24 06:45:03 +08:00
18 lines
427 B
Ruby
18 lines
427 B
Ruby
# frozen_string_literal: true
|
|
|
|
class AddTimezoneToUserOptions < ActiveRecord::Migration[6.0]
|
|
def up
|
|
add_column :user_options, :timezone, :string
|
|
execute(<<-SQL)
|
|
UPDATE user_options
|
|
SET timezone = ucf.value
|
|
FROM user_custom_fields AS ucf
|
|
WHERE ucf.user_id = user_options.user_id AND ucf.name = 'timezone'
|
|
SQL
|
|
end
|
|
|
|
def down
|
|
remove_column :user_options, :timezone
|
|
end
|
|
end
|