feat(cli): improve the "up" commands --from and --to options

The given values can either be migration names or relative paths to migration files.
The given migration must exist to avoid accidentally running migrations that wasn't intended to run.
This commit is contained in:
Joakim Carlstein 2024-01-25 17:59:20 +01:00 committed by Joakim Carlstein
parent 986456b038
commit 9109238b86
12 changed files with 346 additions and 65 deletions

View file

@ -3,7 +3,6 @@ import { BadOptionError, MissingOptionError, StorageInitError, toError } from '.
import { type Config } from '../types.js';
import { exec } from '../exec.js';
import { migrationRunner } from '../migration-runner.js';
import { arrayFromAsync } from '../array-from-async.js';
import { collectMigrations } from '../collect-migrations.js';
import { version } from '../get-package-info.js';
@ -56,7 +55,7 @@ export default async function listCommand({
dry: true,
reporter,
storage,
migrations: await arrayFromAsync(collectedMigrations),
migrations: collectedMigrations,
async validate() {
// No-op
},