]> git.openstreetmap.org Git - rails.git/blob - db/migrate/013_add_email_valid.rb
Update to rails 6.0.3.7
[rails.git] / db / migrate / 013_add_email_valid.rb
1 class AddEmailValid < ActiveRecord::Migration[4.2]
2   class User < ApplicationRecord
3   end
4
5   def self.up
6     add_column "users", "email_valid", :boolean, :default => false, :null => false
7     User.update_all("email_valid = (active != 0)") # email_valid is :boolean, but active is :integer. "email_valid = active" (see r11802 or earlier) will fail for stricter dbs than mysql
8   end
9
10   def self.down
11     remove_column "users", "email_valid"
12   end
13 end