Merge pull request #5380 from opf/fix/increase_cf_timestamp_migration_robustness
increase custom field timestamp migration robustnesspull/4959/merge
commit
d3fb9145c8
@ -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…
Reference in new issue