scinote-web/db/migrate/20180930205254_add_variables_to_users.rb

20 lines
408 B
Ruby
Raw Normal View History

2018-10-12 06:48:12 +08:00
# frozen_string_literal: true
class AddVariablesToUsers < ActiveRecord::Migration[5.1]
VARIABLES = {
export_vars: {
num_of_export_all_last_24_hours: 0
}
}.freeze
def up
add_column :users, :variables, :jsonb, default: {}, null: false
User.reset_column_information
User.update_all(variables: VARIABLES)
end
def down
remove_column :users, :variables, :jsonb
end
end