Fix bug where migration filenames conflict

This commit is contained in:
Eric 2020-04-30 16:14:32 -05:00
parent 858d6cb2e4
commit 910a1c0178
2 changed files with 2 additions and 2 deletions

View file

@ -32,7 +32,7 @@ class CwToActivestorageGenerator < Rails::Generators::Base
def create_column_migration_file def create_column_migration_file
if (Dir.glob("db/migrate/*_rename_uploader_columns.rb").none?) if (Dir.glob("db/migrate/*_rename_uploader_columns.rb").none?)
copy_file "migrate/rename_uploader_columns.rb", copy_file "migrate/rename_uploader_columns.rb",
"db/migrate/#{DateTime.now.strftime('%Y%m%d%H%M%S')}_rename_uploader_columns.rb" "db/migrate/#{(DateTime.now + 1.second).strftime('%Y%m%d%H%M%S')}_rename_uploader_columns.rb"
end end
end end

View file

@ -13,7 +13,7 @@ class RenameUploaderColumns < ActiveRecord::Migration[5.2]
rename_column :nonprofits, :second_image, :second_image_temp rename_column :nonprofits, :second_image, :second_image_temp
rename_column :nonprofits, :third_image, :third_image_temp rename_column :nonprofits, :third_image, :third_image_temp
rename_column :nonprofits, :background_image, :background_image_temp rename_column :nonprofits, :background_image, :background_image_temp
rename_column :nonprofits, :logo_image, :logo_image_temp rename_column :nonprofits, :logo, :logo_temp
rename_column :profiles, :picture, :picture_temp rename_column :profiles, :picture, :picture_temp
end end