diff --git a/db/migrate/20160901131628_add_pinfirmable_columns_to_resource.rb b/db/migrate/20160901131628_add_pinfirmable_columns_to_resource.rb index 8afd529..f2dcefa 100644 --- a/db/migrate/20160901131628_add_pinfirmable_columns_to_resource.rb +++ b/db/migrate/20160901131628_add_pinfirmable_columns_to_resource.rb @@ -1,8 +1,10 @@ class AddPinfirmableColumnsToResource < ActiveRecord::Migration[5.0] def change model = (ENV["MODEL"] || "user").downcase.pluralize.to_sym - add_column model, :pinfirmable_pin, :string - add_column model, :pinfirmable_tries, :integer, default: 0 - add_column model, :pinfirmable_lockout, :datetime, default: nil + unless column_exists?(model, :pinfirmable_pin) + add_column model, :pinfirmable_pin, :string + add_column model, :pinfirmable_tries, :integer, default: 0 + add_column model, :pinfirmable_lockout, :datetime, default: nil + end end end