-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
app: create migration scripts, #TASK-6445
- Loading branch information
Showing
3 changed files
with
50 additions
and
1 deletion.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
...pp/src/main/java/org/opencb/opencga/app/migrations/v4/v4_0_0/catalog/IndexesTask6445.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
...org/opencb/opencga/app/migrations/v4/v4_0_0/catalog/JobModelChangesMigrationTask6445.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters