MCPcopy
hub / github.com/prisma/prisma / DbPush

Class DbPush

packages/migrate/src/commands/DbPush.ts:29–278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27import { printDatasource } from '../utils/printDatasource'
28
29export class DbPush implements Command {
30 public static new(): DbPush {
31 return new DbPush()
32 }
33
34 private static help = format(`
35${process.platform === 'win32' ? '' : '🙌 '}Push the state from your Prisma schema to your database
36
37${bold('Usage')}
38
39 ${dim('$')} prisma db push [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 --url Override the datasource URL from the Prisma config file
49 --accept-data-loss Ignore data loss warnings
50 --force-reset Force a reset of the database before push
51
52${bold('Examples')}
53
54 Push the Prisma schema state to the database
55 ${dim('$')} prisma db push
56
57 Specify a schema
58 ${dim('$')} prisma db push --schema=./schema.prisma
59
60 Ignore data loss warnings
61 ${dim('$')} prisma db push --accept-data-loss
62`)
63
64 public async parse(argv: string[], config: PrismaConfigInternal, baseDir: string): Promise<string | Error> {
65 const args = arg(
66 argv,
67 {
68 '--help': Boolean,
69 '-h': '--help',
70 '--accept-data-loss': Boolean,
71 '--force-reset': Boolean,
72 '--schema': String,
73 '--config': String,
74 '--url': String,
75 '--telemetry-information': String,
76 },
77 false,
78 )
79
80 if (isError(args)) {
81 return this.help(args.message)
82 }
83
84 if (args['--help']) {
85 return this.help()
86 }

Callers

nothing calls this directly

Calls 1

formatFunction · 0.90

Tested by

no test coverage detected