2017-12-21 17:36:29 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-03-07 14:34:19 +00:00
|
|
|
class AddDeviseTo<%= table_name.camelize %> < ActiveRecord::Migration<%= migration_version %>
|
2011-08-25 12:05:19 +00:00
|
|
|
def self.up
|
2016-01-30 17:20:32 +00:00
|
|
|
change_table :<%= table_name %> do |t|
|
2011-12-05 10:28:04 +00:00
|
|
|
<%= migration_data -%>
|
2011-08-25 12:05:19 +00:00
|
|
|
|
2011-11-06 12:47:34 +00:00
|
|
|
<% attributes.each do |attribute| -%>
|
2011-08-25 12:05:19 +00:00
|
|
|
t.<%= attribute.type %> :<%= attribute.name %>
|
|
|
|
<% end -%>
|
2011-08-30 08:50:12 +00:00
|
|
|
|
|
|
|
# Uncomment below if timestamps were not included in your original model.
|
2015-02-03 02:02:52 +00:00
|
|
|
# t.timestamps null: false
|
2011-08-25 12:05:19 +00:00
|
|
|
end
|
2011-08-30 08:50:12 +00:00
|
|
|
|
2014-02-25 16:42:55 +00:00
|
|
|
add_index :<%= table_name %>, :email, unique: true
|
|
|
|
add_index :<%= table_name %>, :reset_password_token, unique: true
|
|
|
|
# add_index :<%= table_name %>, :confirmation_token, unique: true
|
|
|
|
# add_index :<%= table_name %>, :unlock_token, unique: true
|
2011-08-25 12:05:19 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def self.down
|
2011-08-30 08:50:12 +00:00
|
|
|
# By default, we don't want to make any assumption about how to roll back a migration when your
|
|
|
|
# model already existed. Please edit below which fields you would like to remove in this migration.
|
2011-11-06 12:47:34 +00:00
|
|
|
raise ActiveRecord::IrreversibleMigration
|
2011-08-25 12:05:19 +00:00
|
|
|
end
|
|
|
|
end
|