MCPcopy
hub / github.com/prisma/prisma / MigrateResolve

Class MigrateResolve

packages/migrate/src/commands/MigrateResolve.ts:22–183  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20import { printDatasource } from '../utils/printDatasource'
21
22export class MigrateResolve implements Command {
23 public static new(): MigrateResolve {
24 return new MigrateResolve()
25 }
26
27 private static help = format(`
28Resolve issues with database migrations in deployment databases:
29- recover from failed migrations
30- baseline databases when starting to use Prisma Migrate on existing databases
31- reconcile hotfixes done manually on databases with your migration history
32
33Run "prisma migrate status" to identify if you need to use resolve.
34
35Read more about resolving migration history issues: ${link('https://pris.ly/d/migrate-resolve')}
36
37${bold('Usage')}
38
39 ${dim('$')} prisma migrate resolve [options]
40
41 The datasource URL configuration is read from the Prisma config file (e.g., ${italic('prisma.config.ts')}).
42
43${bold('Options')}
44
45 -h, --help Display this help message
46 --config Custom path to your Prisma config file
47 --schema Custom path to your Prisma schema
48 --applied Record a specific migration as applied
49 --rolled-back Record a specific migration as rolled back
50
51${bold('Examples')}
52
53 Update migrations table, recording a specific migration as applied
54 ${dim('$')} prisma migrate resolve --applied 20201231000000_add_users_table
55
56 Update migrations table, recording a specific migration as rolled back
57 ${dim('$')} prisma migrate resolve --rolled-back 20201231000000_add_users_table
58
59 Specify a schema
60 ${dim('$')} prisma migrate resolve --rolled-back 20201231000000_add_users_table --schema=./schema.prisma
61`)
62
63 public async parse(argv: string[], config: PrismaConfigInternal, baseDir: string): Promise<string | Error> {
64 const args = arg(
65 argv,
66 {
67 '--help': Boolean,
68 '-h': '--help',
69 '--applied': String,
70 '--rolled-back': String,
71 '--schema': String,
72 '--config': String,
73 '--telemetry-information': String,
74 },
75 false,
76 )
77
78 if (isError(args)) {
79 return this.help(args.message)

Callers

nothing calls this directly

Calls 2

formatFunction · 0.90
linkFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…