Files
speckle-server/packages/server/modules/cli/commands/db/migrate/latest.ts
T
Kristaps Fabians Geikins a9a313ee63 feat(server): cli and cross-server-sync multiregion support (#3527)
* feat(server): cross-server-sync multiregion ready

* fixed various db commands

* db cli works

* final changes
2024-11-22 19:52:58 +01:00

23 lines
691 B
TypeScript

import { logger } from '@/logging/logging'
import { CommonDbArgs, getTargettedDbClients } from '@/modules/cli/commands/db/helpers'
import { CommandModule } from 'yargs'
const command: CommandModule<unknown, CommonDbArgs> = {
command: 'latest',
describe: 'Run all migrations that have not yet been run',
async handler(argv) {
logger.info('Running latest migrations on DB instances!')
const { regionKey } = argv
const dbs = await getTargettedDbClients({ regionKey })
for (const db of dbs) {
logger.info(`Running latest on DB ${db.regionKey}...`)
await db.client.migrate.latest()
}
logger.info('Completed running migration')
}
}
export = command