Allow to upgrade all workspaces (#1073)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2022-03-01 10:32:01 +07:00 committed by GitHub
parent 5435c4162d
commit 7dba8c4f38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 1 deletions

View File

@ -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')

View File

@ -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)
}
}
}