(argv: string[], config: PrismaConfigInternal, baseDir: string)
| 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']) { |
| 96 | return this.help() |
| 97 | } |
| 98 | |
| 99 | const schemaContext = await loadSchemaContext({ |
| 100 | schemaPath: createSchemaPathInput({ |
| 101 | schemaPathFromArgs: args['--schema'], |
| 102 | schemaPathFromConfig: config.schema, |
| 103 | baseDir, |
| 104 | }), |
| 105 | }) |
| 106 | const { migrationsDirPath } = inferDirectoryConfig(schemaContext, config) |
| 107 | |
| 108 | let cmdSpecificConfig = config |
| 109 | if (args['--url']) { |
| 110 | cmdSpecificConfig = { |
| 111 | ...cmdSpecificConfig, |
| 112 | datasource: { |
| 113 | ...cmdSpecificConfig.datasource, |
| 114 | url: args['--url'], |
| 115 | }, |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | const cmd = 'migrate dev' |
| 120 | const validatedConfig = validatePrismaConfigWithDatasource({ config: cmdSpecificConfig, cmd }) |
| 121 | |
| 122 | checkUnsupportedDataProxy({ cmd, validatedConfig }) |
| 123 | |
| 124 | const datasourceInfo = parseDatasourceInfo(schemaContext.primaryDatasource, validatedConfig) |
| 125 | printDatasource({ datasourceInfo }) |
| 126 | |
| 127 | process.stdout.write('\n') // empty line |
| 128 | |
| 129 | // Validate schema (same as prisma validate) |
| 130 | validate({ schemas: schemaContext.schemaFiles }) |
| 131 | |
| 132 | // TODO: check why the output and error handling here is different than in `MigrateDeploy`. |
| 133 | // Automatically create the database if it doesn't exist |
nothing calls this directly
no test coverage detected