Make sure copied migrations are named via utc timezone

This commit is contained in:
Eric 2020-05-05 13:17:36 -05:00
parent 5a10155755
commit 23398ae552
2 changed files with 5 additions and 3 deletions

View file

@ -36,7 +36,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 + 1.second).strftime('%Y%m%d%H%M%S')}_rename_uploader_columns.rb" "db/migrate/#{(DateTime.now.utc + 1.second).strftime('%Y%m%d%H%M%S')}_rename_uploader_columns.rb"
end end
end end

View file

@ -107,9 +107,11 @@ end
end end
task :create_backup_uploader_migration do task :create_backup_uploader_migration do
byebug
if (Dir.glob("db/migrate/*_backup_uploader_columns.rb").none?) if (Dir.glob("db/migrate/*_backup_uploader_columns.rb").none?)
FileUtils.cp __dir + "/templates/backup_uploader_columns.rb", byebug
"db/migrate/#{(DateTime.now + 1.second).strftime('%Y%m%d%H%M%S')}_backup_uploader_columns.rb" FileUtils.cp __dir__ + "/templates/backup_uploader_columns.rb",
"db/migrate/#{(DateTime.now.utc + 1.second).strftime('%Y%m%d%H%M%S')}_backup_uploader_columns.rb"
end end
end end