diff --git a/dev/tool/src/index.ts b/dev/tool/src/index.ts index a9b21ed486..03cc68d574 100644 --- a/dev/tool/src/index.ts +++ b/dev/tool/src/index.ts @@ -119,6 +119,19 @@ program }) }) +program + .command('upgrade') + .description('upgrade') + .action(async (cmd) => { + return await withDatabase(mongodbUri, async (db) => { + const workspaces = await listWorkspaces(db) + for (const ws of workspaces) { + console.log('---UPGRADING----', ws.workspace) + await upgradeWorkspace(db, ws.workspace) + } + }) + }) + program .command('drop-workspace <name>') .description('drop workspace') diff --git a/server/tool/src/index.ts b/server/tool/src/index.ts index 66b52f34bd..1638ed916a 100644 --- a/server/tool/src/index.ts +++ b/server/tool/src/index.ts @@ -199,9 +199,13 @@ async function createUpdateIndexes (connection: CoreClient, db: Db): Promise<voi for (const [d, v] of domains.entries()) { const collection = db.collection(d) + const bb: string[] = [] for (const vv of v.values()) { - console.log('creating index', d, vv) await collection.createIndex(vv) + bb.push(vv) + } + if (bb.length > 0) { + console.log('created indexes', d, bb) } } }