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

Method parse

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

Source from the content-addressed store, hash-verified

54`)
55
56 public async parse(argv: string[], config: PrismaConfigInternal, baseDir: string): Promise<string | Error> {
57 const args = arg(
58 argv,
59 {
60 '--help': Boolean,
61 '-h': '--help',
62 '--schema': String,
63 '--config': String,
64 '--telemetry-information': String,
65 },
66 false,
67 )
68
69 if (isError(args)) {
70 return this.help(args.message)
71 }
72
73 if (args['--help']) {
74 return this.help()
75 }
76
77 const schemaContext = await loadSchemaContext({
78 schemaPath: createSchemaPathInput({
79 schemaPathFromArgs: args['--schema'],
80 schemaPathFromConfig: config.schema,
81 baseDir,
82 }),
83 })
84 const { migrationsDirPath } = inferDirectoryConfig(schemaContext, config)
85
86 const cmd = 'migrate deploy'
87 const validatedConfig = validatePrismaConfigWithDatasource({ config, cmd })
88
89 checkUnsupportedDataProxy({ cmd, validatedConfig })
90
91 printDatasource({ datasourceInfo: parseDatasourceInfo(schemaContext.primaryDatasource, validatedConfig) })
92
93 const schemaFilter: MigrateTypes.SchemaFilter = {
94 externalTables: config.tables?.external ?? [],
95 externalEnums: config.enums?.external ?? [],
96 }
97
98 const migrate = await Migrate.setup({
99 schemaEngineConfig: config,
100 baseDir,
101 migrationsDirPath,
102 schemaContext,
103 schemaFilter,
104 extensions: config['extensions'],
105 })
106
107 try {
108 // Automatically create the database if it doesn't exist
109 const successMessage = await ensureDatabaseExists(
110 baseDir,
111 getSchemaDatasourceProvider(schemaContext),
112 validatedConfig,
113 )

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
printDatasourceFunction · 0.90
parseDatasourceInfoFunction · 0.90
ensureDatabaseExistsFunction · 0.90

Tested by

no test coverage detected