Merge pull request #5380 from opf/fix/increase_cf_timestamp_migration_robustness

increase custom field timestamp migration robustness
pull/4959/merge
Markus Kahl 8 years ago committed by GitHub
commit d3fb9145c8
  1. 18
      db/migrate/20170418064453_add_timestamp_to_custom_fields.rb

@ -1,9 +1,17 @@
class AddTimestampToCustomFields < ActiveRecord::Migration[5.0] class AddTimestampToCustomFields < ActiveRecord::Migration[5.0]
def change def up
add_column :custom_fields, :created_at, :datetime add_column :custom_fields, :created_at, :datetime unless column_exists? :custom_fields, :created_at
add_column :custom_fields, :updated_at, :datetime 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 unless column_exists? :custom_options, :created_at
add_column :custom_options, :created_at, :datetime 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
end end

Loading…
Cancel
Save