discourse/db/migrate/20130911182437_create_user_stats.rb
Sam Saffron 30990006a9 DEV: enable frozen string literal on all files
This reduces chances of errors where consumers of strings mutate inputs
and reduces memory usage of the app.

Test suite passes now, but there may be some stuff left, so we will run
a few sites on a branch prior to merging
2019-05-13 09:31:32 +08:00

18 lines
437 B
Ruby

# frozen_string_literal: true
class CreateUserStats < ActiveRecord::Migration[4.2]
def up
create_table :user_stats, id: false do |t|
t.references :user, null: false
t.boolean :has_custom_avatar, default: false, null: false
end
execute "ALTER TABLE user_stats ADD PRIMARY KEY (user_id)"
execute "INSERT INTO user_stats (user_id) SELECT id FROM users"
end
def down
drop_table :user_stats
end
end