]> git.openstreetmap.org Git - rails.git/blob - db/migrate/013_add_email_valid.rb
Add frozen_string_literal comments to ruby files
[rails.git] / db / migrate / 013_add_email_valid.rb
1 # frozen_string_literal: true
2
3 class AddEmailValid < ActiveRecord::Migration[4.2]
4   class User < ApplicationRecord
5   end
6
7   def self.up
8     add_column "users", "email_valid", :boolean, :default => false, :null => false
9     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
10   end
11
12   def self.down
13     remove_column "users", "email_valid"
14   end
15 end