20160301113717_add_confirmable_attributes_to_users.rb 564 B

1234567891011121314151617
  1. class AddConfirmableAttributesToUsers < ActiveRecord::Migration[4.2]
  2. def change
  3. change_table(:users) do |t|
  4. ## Confirmable
  5. t.string :confirmation_token
  6. t.datetime :confirmed_at
  7. t.datetime :confirmation_sent_at
  8. t.string :unconfirmed_email # Only if using reconfirmable
  9. end
  10. add_index :users, :confirmation_token, unique: true
  11. if ENV['REQUIRE_CONFIRMED_EMAIL'] != 'true' && ActiveRecord::Base.connection.column_exists?(:users, :confirmed_at)
  12. User.update_all(confirmed_at: Time.zone.now)
  13. end
  14. end
  15. end