diff --git a/lib/tasks/deployment/20190828130014_rename_active_storage_attachments.rake b/lib/tasks/deployment/20190828130014_rename_active_storage_attachments.rake new file mode 100644 index 000000000..11e5fd671 --- /dev/null +++ b/lib/tasks/deployment/20190828130014_rename_active_storage_attachments.rake @@ -0,0 +1,14 @@ +namespace :after_party do + desc 'Deployment task: rename_active_storage_attachments' + task rename_active_storage_attachments: :environment do + puts "Running deploy task 'rename_active_storage_attachments'" + + ActiveStorage::Attachment.where(name: 'logo_active_storage').update_all(name: 'logo') + ActiveStorage::Attachment.where(name: 'signature_active_storage').update_all(name: 'signature') + ActiveStorage::Attachment.where(name: 'pdf_active_storage').update_all(name: 'pdf') + + # Update task as completed. If you remove the line below, the task will + # run with every deploy (or every time you call after_party:run). + AfterParty::TaskRecord.create version: '20190828130014' + end +end