(argv: string[], config: PrismaConfigInternal, baseDir: string)
| 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 status' |
| 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 | await ensureCanConnectToDatabase(baseDir, validatedConfig) |
| 108 | |
| 109 | // This is a *read-only* command (modulo shadow database). |
| 110 | // - ↩️ **RPC**: ****`diagnoseMigrationHistory`, then four cases based on the response. |
| 111 | // 4. Otherwise, there is no problem migrate is aware of. We could still display: |
| 112 | // - Modified since applied only relevant when using dev, they are ignored for deploy |
| 113 | // - Pending migrations (those in the migrations folder that haven't been applied yet) |
nothing calls this directly
no test coverage detected