diff --git a/src/main/resources/db/migration/V7_0__NewDatabaseStructure.sql b/src/main/resources/db/migration/V7_0__NewDatabaseStructure.sql
index 6f0380aee596bad76cb9a4ce6cf1f35eefcaf9bf..81b7fbcc628336acf51ddc94493d9c9809c12737 100644
--- a/src/main/resources/db/migration/V7_0__NewDatabaseStructure.sql
+++ b/src/main/resources/db/migration/V7_0__NewDatabaseStructure.sql
@@ -23,8 +23,8 @@ DROP COLUMN model_slug;
 
 ALTER TABLE experiment RENAME algorithms TO algorithm;
 UPDATE experiment SET algorithm = (algorithm::json ->> 0);
-UPDATE experiment SET algorithmId = (algorithm::json ->> 'name');
 ALTER TABLE experiment ADD COLUMN algorithmId text;
+UPDATE experiment SET algorithmId = (algorithm::json ->> 'name');
 UPDATE experiment SET result = result::json #>>'{0,result}' WHERE (algorithm::json->>'type') <> 'workflow';
 
 ALTER TABLE experiment