diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/migrations/v4/v4_0_0/catalog/IndexesTask6445.java b/opencga-app/src/main/java/org/opencb/opencga/app/migrations/v4/v4_0_0/catalog/IndexesTask6445.java new file mode 100644 index 0000000000..06862c5b8c --- /dev/null +++ b/opencga-app/src/main/java/org/opencb/opencga/app/migrations/v4/v4_0_0/catalog/IndexesTask6445.java @@ -0,0 +1,16 @@ +package org.opencb.opencga.app.migrations.v4.v4_0_0.catalog; + +import org.opencb.opencga.catalog.migration.Migration; +import org.opencb.opencga.catalog.migration.MigrationTool; + +@Migration(id = "new_indexes_6445", + description = "New indexes from #TASK-6445", version = "4.0.0", + language = Migration.MigrationLanguage.JAVA, domain = Migration.MigrationDomain.CATALOG, date = 20241113) +public class IndexesTask6445 extends MigrationTool { + + @Override + protected void run() throws Exception { + catalogManager.installIndexes(organizationId, token); + } + +} diff --git a/opencga-app/src/main/java/org/opencb/opencga/app/migrations/v4/v4_0_0/catalog/JobModelChangesMigrationTask6445.java b/opencga-app/src/main/java/org/opencb/opencga/app/migrations/v4/v4_0_0/catalog/JobModelChangesMigrationTask6445.java new file mode 100644 index 0000000000..74441fdc00 --- /dev/null +++ b/opencga-app/src/main/java/org/opencb/opencga/app/migrations/v4/v4_0_0/catalog/JobModelChangesMigrationTask6445.java @@ -0,0 +1,34 @@ +package org.opencb.opencga.app.migrations.v4.v4_0_0.catalog; + + +import com.mongodb.client.model.Filters; +import com.mongodb.client.model.Updates; +import org.bson.Document; +import org.bson.conversions.Bson; +import org.opencb.opencga.catalog.db.mongodb.OrganizationMongoDBAdaptorFactory; +import org.opencb.opencga.catalog.migration.Migration; +import org.opencb.opencga.catalog.migration.MigrationTool; + +import java.util.Arrays; +import java.util.Collections; + +@Migration(id = "job_model_changes_6445", + description = "Job data model changes #TASK-6445", version = "4.0.0", + language = Migration.MigrationLanguage.JAVA, domain = Migration.MigrationDomain.CATALOG, date = 20241113) +public class JobModelChangesMigrationTask6445 extends MigrationTool { + + @Override + protected void run() throws Exception { + Bson query = Filters.exists("type", false); + Bson update = Updates.combine( + Updates.set("type", "NATIVE"), + Updates.set("tool.minimumRequirements", new Document()), + Updates.set("execution.dependencies", Collections.emptyList()) + ); + for (String collection : Arrays.asList(OrganizationMongoDBAdaptorFactory.JOB_COLLECTION, + OrganizationMongoDBAdaptorFactory.DELETED_JOB_COLLECTION)) { + getMongoCollection(collection).updateMany(query, update); + } + } + +} diff --git a/opencga-catalog/src/main/resources/catalog-indexes.txt b/opencga-catalog/src/main/resources/catalog-indexes.txt index 2d0dc01ad9..7323423ce6 100644 --- a/opencga-catalog/src/main/resources/catalog-indexes.txt +++ b/opencga-catalog/src/main/resources/catalog-indexes.txt @@ -20,7 +20,6 @@ {"collections": ["job"], "fields": {"id": 1, "studyUid": 1}, "options": {"unique": true}} {"collections": ["job"], "fields": {"tool.id": 1, "studyUid": 1}, "options": {}} {"collections": ["job"], "fields": {"tool.type": 1, "studyUid": 1}, "options": {}} -{"collections": ["job"], "fields": {"tool.externalExecutor.id": 1, "studyUid": 1}, "options": {}} {"collections": ["job"], "fields": {"userId": 1, "studyUid": 1}, "options": {}} {"collections": ["job"], "fields": {"parentId": 1, "studyUid": 1}, "options": {}} {"collections": ["job"], "fields": {"outDir.uid": 1, "studyUid": 1}, "options": {}}