diff --git a/db/migrate/20170418064453_add_timestamp_to_custom_fields.rb b/db/migrate/20170418064453_add_timestamp_to_custom_fields.rb index 58bcd94206..26a4876915 100644 --- a/db/migrate/20170418064453_add_timestamp_to_custom_fields.rb +++ b/db/migrate/20170418064453_add_timestamp_to_custom_fields.rb @@ -1,9 +1,17 @@ class AddTimestampToCustomFields < ActiveRecord::Migration[5.0] - def change - add_column :custom_fields, :created_at, :datetime - add_column :custom_fields, :updated_at, :datetime + def up + add_column :custom_fields, :created_at, :datetime unless column_exists? :custom_fields, :created_at + add_column :custom_fields, :updated_at, :datetime unless column_exists? :custom_fields, :updated_at - add_column :custom_options, :updated_at, :datetime - add_column :custom_options, :created_at, :datetime + add_column :custom_options, :created_at, :datetime unless column_exists? :custom_options, :created_at + add_column :custom_options, :updated_at, :datetime unless column_exists? :custom_options, :updated_at + end + + def down + remove_column :custom_fields, :created_at, :datetime + remove_column :custom_fields, :updated_at, :datetime + + remove_column :custom_options, :created_at, :datetime + remove_column :custom_options, :updated_at, :datetime end end