0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-06 08:06:54 +08:00
discourse/db/migrate/20191120015344_add_timezone_to_user_options.rb
2023-01-09 11:59:41 +00:00

17 lines
427 B
Ruby
Vendored

# 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