From 93d34aad0268f84c6fe32f69df374c985aa38ed0 Mon Sep 17 00:00:00 2001 From: Samuel Couillard <43917914+scouillard@users.noreply.github.com> Date: Tue, 31 Jan 2023 13:48:03 -0500 Subject: [PATCH] Add Errors Logs to Migration (v2) (#4678) * Add Errors logging to Migration (v2) * Improve error logging * rubo * Fix last line removal mistake --- lib/tasks/migrations/migrations.rake | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/lib/tasks/migrations/migrations.rake b/lib/tasks/migrations/migrations.rake index 8d9dd6c7..8ab761e2 100644 --- a/lib/tasks/migrations/migrations.rake +++ b/lib/tasks/migrations/migrations.rake @@ -39,12 +39,13 @@ namespace :migrations do case response when Net::HTTPCreated puts green "Succesfully migrated Role:" - puts cyan " ID: #{r.id}" - puts cyan " Name: #{params[:role][:name]}" + puts cyan "ID: #{r.id}" + puts cyan "Name: #{params[:role][:name]}" else puts red "Unable to migrate Role:" - puts yellow " ID: #{r.id}" - puts yellow " Name: #{params[:role][:name]}" + puts yellow "ID: #{r.id}" + puts yellow "Name: #{params[:role][:name]}" + puts red "Errors: #{JSON.parse(response.body.to_s)['errors']}" has_encountred_issue = 1 # At least one of the migrations failed. end end @@ -76,8 +77,9 @@ namespace :migrations do puts cyan " Name: #{params[:user][:name]}" else puts red "Unable to migrate User:" - puts yellow " UID: #{u.uid}" - puts yellow " Name: #{params[:user][:name]}" + puts yellow "UID: #{u.uid}" + puts yellow "Name: #{params[:user][:name]}" + puts red "Errors: #{JSON.parse(response.body.to_s)['errors']}" has_encountred_issue = 1 # At least one of the migrations failed. end end @@ -136,12 +138,13 @@ namespace :migrations do case response when Net::HTTPCreated puts green "Succesfully migrated Room:" - puts cyan " UID: #{r.uid}" - puts cyan " Name: #{r.name}" + puts cyan "UID: #{r.uid}" + puts cyan "Name: #{r.name}" else puts red "Unable to migrate Room:" - puts yellow " UID: #{r.uid}" - puts yellow " Name: #{r.name}" + puts yellow "UID: #{r.uid}" + puts yellow "Name: #{r.name}" + puts red "Errors: #{JSON.parse(response.body.to_s)['errors']}" has_encountred_issue = 1 # At least one of the migrations failed. end end @@ -192,6 +195,7 @@ namespace :migrations do puts green "Successfully migrated Settings" else puts red "Unable to migrate Settings" + puts red "Errors: #{JSON.parse(response.body.to_s)['errors']}" has_encountred_issue = 1 # At least one of the migrations failed. end -- GitLab