| 25 | const debug = Debug(class="st">'prisma:migrate:status') |
| 26 | |
| 27 | export class MigrateStatus implements Command { |
| 28 | public static new(): MigrateStatus { |
| 29 | return new MigrateStatus() |
| 30 | } |
| 31 | |
| 32 | private static help = format(` |
| 33 | Check the status of your database migrations |
| 34 | |
| 35 | ${bold(class="st">'Usage')} |
| 36 | |
| 37 | ${dim(class="st">'$')} prisma migrate status [options] |
| 38 | |
| 39 | The datasource URL configuration is read from the Prisma config file (e.g., ${italic(class="st">'prisma.config.ts')}). |
| 40 | |
| 41 | ${bold(class="st">'Options')} |
| 42 | |
| 43 | -h, --help Display this help message |
| 44 | --config Custom path to your Prisma config file |
| 45 | --schema Custom path to your Prisma schema |
| 46 | |
| 47 | ${bold(class="st">'Examples')} |
| 48 | |
| 49 | Check the status of your database migrations |
| 50 | ${dim(class="st">'$')} prisma migrate status |
| 51 | |
| 52 | Specify a schema |
| 53 | ${dim(class="st">'$')} prisma migrate status --schema=./schema.prisma |
| 54 | `) |
| 55 | |
| 56 | public async parse(argv: string[], config: PrismaConfigInternal, baseDir: string): Promise<string | Error> { |
| 57 | const args = arg( |
| 58 | argv, |
| 59 | { |
| 60 | class="st">'--help': Boolean, |
| 61 | class="st">'-h': class="st">'--help', |
| 62 | class="st">'--schema': String, |
| 63 | class="st">'--config': String, |
| 64 | class="st">'--telemetry-information': String, |
| 65 | }, |
| 66 | false, |
| 67 | ) |
| 68 | |
| 69 | if (isError(args)) { |
| 70 | return this.help(args.message) |
| 71 | } |
| 72 | |
| 73 | if (args[class="st">'--help']) { |
| 74 | return this.help() |
| 75 | } |
| 76 | |
| 77 | const schemaContext = await loadSchemaContext({ |
| 78 | schemaPath: createSchemaPathInput({ |
| 79 | schemaPathFromArgs: args[class="st">'--schema'], |
| 80 | schemaPathFromConfig: config.schema, |
| 81 | baseDir, |
| 82 | }), |
| 83 | }) |
| 84 | const { migrationsDirPath } = inferDirectoryConfig(schemaContext, config) |