From 5d448fd152e1d7a3d5d1c16f312d8dcb01dfcc02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Vantomme?= Date: Tue, 25 Jan 2022 11:59:42 +0100 Subject: [PATCH] fix(export): set a random UUID key before forcing not null --- .../20210402000000_null_export_keys_to_uuid.rake | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 lib/tasks/deployment/20210402000000_null_export_keys_to_uuid.rake diff --git a/lib/tasks/deployment/20210402000000_null_export_keys_to_uuid.rake b/lib/tasks/deployment/20210402000000_null_export_keys_to_uuid.rake new file mode 100644 index 000000000..4d90676c5 --- /dev/null +++ b/lib/tasks/deployment/20210402000000_null_export_keys_to_uuid.rake @@ -0,0 +1,13 @@ +namespace :after_party do + desc 'Deployment task: null_exports_key_to_uuid' + task null_exports_key_to_uuid: :environment do + puts "Running deploy task 'null_exports_key_to_uuid'" + + Export.where(key: nil).update_all(key: SecureRandom.uuid) + + # 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: AfterParty::TaskRecorder.new(__FILE__).timestamp + end +end