Files
speckle-server/packages/server/modules/cli/commands/db/migrate/up.ts
T
Kristaps Fabians Geikins 4b06f42db7 chore(server): run TS files directly (no compilation) (#5134)
* sort of works

* type fixes

* added option to run old way too
2025-07-23 11:20:40 +02:00

25 lines
759 B
TypeScript

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