MCPcopy
hub / github.com/prisma/prisma / MigrateDev

Class MigrateDev

packages/migrate/src/commands/MigrateDev.ts:38–356  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36const debug = Debug('prisma:migrate:dev')
37
38export class MigrateDev implements Command {
39 public static new(): MigrateDev {
40 return new MigrateDev()
41 }
42
43 private static help = format(`
44${
45 process.platform === 'win32' ? '' : '🏋️ '
46}Create a migration from changes in Prisma schema, apply it to the database, trigger generators (e.g. Prisma Client)
47
48${bold('Usage')}
49
50 ${dim('$')} prisma migrate dev [options]
51
52 The datasource URL configuration is read from the Prisma config file (e.g., ${italic('prisma.config.ts')}).
53
54${bold('Options')}
55
56 -h, --help Display this help message
57 --config Custom path to your Prisma config file
58 --schema Custom path to your Prisma schema
59 --url Override the datasource URL from the Prisma config file
60 -n, --name Name the migration
61 --create-only Create a new migration but do not apply it
62 The migration will be empty if there are no changes in Prisma schema
63
64${bold('Examples')}
65
66 Create a migration from changes in Prisma schema, apply it to the database, trigger generators (e.g. Prisma Client)
67 ${dim('$')} prisma migrate dev
68
69 Specify a schema
70 ${dim('$')} prisma migrate dev --schema=./schema.prisma
71
72 Create a migration without applying it
73 ${dim('$')} prisma migrate dev --create-only
74 `)
75
76 public async parse(argv: string[], config: PrismaConfigInternal, baseDir: string): Promise<string | Error> {
77 const args = arg(argv, {
78 '--help': Boolean,
79 '-h': '--help',
80 '--name': String,
81 '-n': '--name',
82 // '--force': Boolean,
83 // '-f': '--force',
84 '--create-only': Boolean,
85 '--schema': String,
86 '--config': String,
87 '--url': String,
88 '--telemetry-information': String,
89 })
90
91 if (isError(args)) {
92 return this.help(args.message)
93 }
94
95 if (args['--help']) {

Callers

nothing calls this directly

Calls 1

formatFunction · 0.90

Tested by

no test coverage detected