MCPcopy
hub / github.com/prisma/prisma / parse

Method parse

packages/migrate/src/commands/DbPush.ts:64–270  ·  view source on GitHub ↗
(argv: string[], config: PrismaConfigInternal, baseDir: string)

Source from the content-addressed store, hash-verified

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 }
87
88 const schemaContext = await loadSchemaContext({
89 schemaPath: createSchemaPathInput({
90 schemaPathFromArgs: args['--schema'],
91 schemaPathFromConfig: config.schema,
92 baseDir,
93 }),
94 })
95
96 const { migrationsDirPath } = inferDirectoryConfig(schemaContext, config)
97
98 let cmdSpecificConfig = config
99 if (args['--url']) {
100 cmdSpecificConfig = {
101 ...cmdSpecificConfig,
102 datasource: {
103 ...cmdSpecificConfig.datasource,
104 url: args['--url'],
105 },
106 }
107 }
108
109 const cmd = 'db push'
110 const validatedConfig = validatePrismaConfigWithDatasource({ config: cmdSpecificConfig, cmd })
111
112 checkUnsupportedDataProxy({ cmd, validatedConfig })
113
114 const datasourceInfo = parseDatasourceInfo(schemaContext.primaryDatasource, validatedConfig)
115 printDatasource({ datasourceInfo })
116 const schemaFilter: MigrateTypes.SchemaFilter = {
117 externalTables: cmdSpecificConfig.tables?.external ?? [],
118 externalEnums: cmdSpecificConfig.enums?.external ?? [],
119 }
120
121 const migrate = await Migrate.setup({

Callers

nothing calls this directly

Calls 15

helpMethod · 0.95
argFunction · 0.90
isErrorFunction · 0.90
loadSchemaContextFunction · 0.90
createSchemaPathInputFunction · 0.90
inferDirectoryConfigFunction · 0.90
parseDatasourceInfoFunction · 0.90
printDatasourceFunction · 0.90
ensureDatabaseExistsFunction · 0.90

Tested by

no test coverage detected