Files
danbooru/db/migrate/20201219201007_rename_post_replacement_attributes.rb
evazion 4cb39422b2 post replacements: rename <attr>_was to old_<attr>
Rename the following post replacement attributes:

* file_size_was -> old_file_size
* file_ext_was -> old_file_ext
* image_width_was -> old_image_width
* image_height_was -> old_image_height
* md5_was -> old_md5

In Rails 6.1, having attributes named `file_size` and `file_size_was` on
the same model breaks things because it conflicts with Rails' dirty
attribute tracking.
2020-12-19 14:26:07 -06:00

10 lines
433 B
Ruby

class RenamePostReplacementAttributes < ActiveRecord::Migration[6.1]
def change
rename_column :post_replacements, :file_ext_was, :old_file_ext
rename_column :post_replacements, :file_size_was, :old_file_size
rename_column :post_replacements, :image_width_was, :old_image_width
rename_column :post_replacements, :image_height_was, :old_image_height
rename_column :post_replacements, :md5_was, :old_md5
end
end