From: Andy Allan Date: Sat, 8 Nov 2008 15:01:14 +0000 (+0000) Subject: Boolean correctness in migrations X-Git-Tag: live~7557^2~200 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/061d77726666beb8bccc27e0d410c4dc0ee4ef09?ds=sidebyside Boolean correctness in migrations --- diff --git a/db/migrate/013_add_email_valid.rb b/db/migrate/013_add_email_valid.rb index b8af4bf6a..2192383bd 100644 --- a/db/migrate/013_add_email_valid.rb +++ b/db/migrate/013_add_email_valid.rb @@ -1,7 +1,7 @@ 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 diff --git a/db/migrate/015_add_user_visible.rb b/db/migrate/015_add_user_visible.rb index d870dfffd..869f24c37 100644 --- a/db/migrate/015_add_user_visible.rb +++ b/db/migrate/015_add_user_visible.rb @@ -1,7 +1,7 @@ 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 diff --git a/db/migrate/021_add_changesets.rb b/db/migrate/021_add_changesets.rb index 9b769c772..e0cf3904a 100644 --- a/db/migrate/021_add_changesets.rb +++ b/db/migrate/021_add_changesets.rb @@ -28,7 +28,7 @@ class AddChangesets < ActiveRecord::Migration # 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