Use common set of tables and columns to migrate on upgrade for rename_uploader_column migration

This commit is contained in:
Eric 2020-05-04 16:29:39 -05:00
parent e19e60322b
commit 4d29b67939

View file

@ -1,19 +1,9 @@
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
class RenameUploaderColumns < ActiveRecord::Migration[5.2]
rename_column :campaigns, :main_image, :main_image_temp
rename_column :campaigns, :background_image, :background_image_temp
rename_column :campaigns, :banner_image, :banner_image_temp
rename_column :events, :main_image, :main_image_temp
rename_column :events, :background_image, :background_image_temp
rename_column :image_attachments, :file, :file_temp
rename_column :nonprofits, :main_image, :main_image_temp
rename_column :nonprofits, :second_image, :second_image_temp
rename_column :nonprofits, :third_image, :third_image_temp
rename_column :nonprofits, :background_image, :background_image_temp
rename_column :nonprofits, :logo, :logo_temp
rename_column :profiles, :picture, :picture_temp
require "houdini_upgrade"
HoudiniUpgrade::UPLOADERS_TO_MIGRATE.each do |table|
table.fields.each do |field|
rename_column table.name, field.name, field.migrated_name
end
end
end