Skip to content

Commit

Permalink
update checks for collection creation
Browse files Browse the repository at this point in the history
  • Loading branch information
amhudson committed Nov 9, 2021
1 parent 2eb58dd commit 6a63bd8
Showing 1 changed file with 20 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,34 @@ public void initialSetup(MongoDatabase db) throws IOException {

logger.info("Running change log: #1 - Creating Collections for Boomerang Flow");

db.createCollection(collectionPrefix + "task_templates");
db.createCollection(collectionPrefix + "teams");
MongoCollection<Document> collection = db.getCollection(collectionPrefix + "task_templates");
if (collection == null) {
db.createCollection(collectionPrefix + "task_templates");
}

collection = db.getCollection(collectionPrefix + "teams");
if (collection == null) {
db.createCollection(collectionPrefix + "teams");
}

try {
collection = db.getCollection(collectionPrefix + "workflows");
if (collection == null) {
db.createCollection(collectionPrefix + "workflows");
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
db.createCollection(collectionPrefix + "workflows_activity");
db.createCollection(collectionPrefix + "workflows_activity_task");

collection = db.getCollection(collectionPrefix + "workflows_activity");
if (collection == null) {
db.createCollection(collectionPrefix + "workflows_activity");
}

collection = db.getCollection(collectionPrefix + "workflows_activity_task");
if (collection == null) {
db.createCollection(collectionPrefix + "workflows_activity_task");
}

try {
collection = db.getCollection(collectionPrefix + "workflows_revisions");
if (collection == null) {
db.createCollection(collectionPrefix + "workflows_revisions");
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
}

Expand Down

0 comments on commit 6a63bd8

Please sign in to comment.