dawarich/db/migrate/future_add_timezone_to_users.rb.example
2025-07-22 23:57:25 +02:00

16 lines
No EOL
466 B
Text

# Example migration for adding per-user timezone support
# To use: rename this file to remove .example and run rails db:migrate
class AddTimezoneToUsers < ActiveRecord::Migration[7.1]
def change
add_column :users, :timezone, :string, default: 'UTC'
add_index :users, :timezone
# Populate existing users with application timezone
reversible do |dir|
dir.up do
User.update_all(timezone: Time.zone.name)
end
end
end
end