class AddEmailValid < ActiveRecord::Migration
def self.up
add_column "users", "email_valid", :boolean, :default => false, :null => false
- User.update_all("email_valid = active")
+ User.update_all(:email_valid => true)
end
def self.down
class AddUserVisible < ActiveRecord::Migration
def self.up
add_column "users", "visible", :boolean, :default => true, :null => false
- User.update_all("visible = 1")
+ User.update_all(:visible => true)
end
def self.down
# all the changesets will have the id of the user that made them.
# We need to generate a changeset for each user in the database
execute "INSERT INTO changesets (id, user_id, created_at, open)" +
- "SELECT id, id, creation_time, 0 from users;"
+ "SELECT id, id, creation_time, false from users;"
@@conv_user_tables.each { |tbl|
rename_column tbl, :user_id, :changeset_id