From 7e6e4aac54c8bc000f9d3481fd0390beab001cb1 Mon Sep 17 00:00:00 2001
From: kfilippopolitis <kostasfilippop@gmail.com>
Date: Fri, 11 Jun 2021 00:56:43 -0700
Subject: [PATCH] Revert the change in galaxy algorithm's results format in the
 migration script.

---
 .../resources/db/migration/V7_0__NewDatabaseStructure.sql | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/main/resources/db/migration/V7_0__NewDatabaseStructure.sql b/src/main/resources/db/migration/V7_0__NewDatabaseStructure.sql
index 3f9f7c0c6..6f0380aee 100644
--- a/src/main/resources/db/migration/V7_0__NewDatabaseStructure.sql
+++ b/src/main/resources/db/migration/V7_0__NewDatabaseStructure.sql
@@ -23,13 +23,9 @@ DROP COLUMN model_slug;
 
 ALTER TABLE experiment RENAME algorithms TO algorithm;
 UPDATE experiment SET algorithm = (algorithm::json ->> 0);
-
-UPDATE experiment SET result = result::json #>>'{0,result}' WHERE (algorithm::json->>'type') <> 'workflow';
-UPDATE experiment SET result = (SELECT jsonb_agg(value -> 'result') FROM jsonb_array_elements(result::jsonb)) WHERE (algorithm::json->>'type') = 'workflow';
-UPDATE experiment SET result = (SELECT jsonb_agg(d.data) FROM jsonb_array_elements(result::jsonb) t, json_array_elements(t.value::json) d(data)) WHERE (algorithm::json->>'type') = 'workflow';
-
-ALTER TABLE experiment ADD COLUMN algorithmId text;
 UPDATE experiment SET algorithmId = (algorithm::json ->> 'name');
+ALTER TABLE experiment ADD COLUMN algorithmId text;
+UPDATE experiment SET result = result::json #>>'{0,result}' WHERE (algorithm::json->>'type') <> 'workflow';
 
 ALTER TABLE experiment
 RENAME createdby_username TO created_by_username;
-- 
GitLab