"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var chunk_DNNMOG7A_exports = {};
__export(chunk_DNNMOG7A_exports, {
  MigrateCommand: () => MigrateCommand
});
module.exports = __toCommonJS(chunk_DNNMOG7A_exports);
var import_chunk_SKRR5WT4 = require("./chunk-SKRR5WT4.js");
var import_internals = require("@prisma/internals");
var MigrateCommand = class _MigrateCommand {
  constructor(cmds) {
    this.cmds = cmds;
  }
  static new(cmds) {
    return new _MigrateCommand(cmds);
  }
  static help = (0, import_internals.format)(`
Update the database schema with migrations

${(0, import_chunk_SKRR5WT4.bold)("Usage")}

  ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate [command] [options]

${(0, import_chunk_SKRR5WT4.bold)("Commands for development")}

         dev   Create a migration from changes in Prisma schema, apply it to the database
               trigger generators (e.g. Prisma Client)
       reset   Reset your database and apply all migrations, all data will be lost

${(0, import_chunk_SKRR5WT4.bold)("Commands for production/staging")}

      deploy   Apply pending migrations to the database
      status   Check the status of your database migrations
     resolve   Resolve issues with database migrations, i.e. baseline, failed migration, hotfix

${(0, import_chunk_SKRR5WT4.bold)("Command for any stage")}

        diff   Compare the database schema from two arbitrary sources

${(0, import_chunk_SKRR5WT4.bold)("Options")}

  -h, --help   Display this help message
    --config   Custom path to your Prisma config file
    --schema   Custom path to your Prisma schema

${(0, import_chunk_SKRR5WT4.bold)("Examples")}

  Create a migration from changes in Prisma schema, apply it to the database, trigger generators (e.g. Prisma Client)
  ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate dev

  Reset your database and apply all migrations
  ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate reset

  Apply pending migrations to the database in production/staging
  ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate deploy

  Check the status of migrations in the production/staging database
  ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate status

  Specify a schema
  ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate status --schema=./schema.prisma

  Compare the database schema from two databases and render the diff as a SQL script
  ${(0, import_chunk_SKRR5WT4.dim)("$")} prisma migrate diff \\
    --from-url "$DATABASE_URL" \\
    --to-url "postgresql://login:password@localhost:5432/db" \\
    --script
`);
  async parse(argv, config, baseDir) {
    const args = (0, import_internals.arg)(argv, {
      "--help": Boolean,
      "-h": "--help",
      "--config": String,
      "--preview-feature": Boolean,
      "--telemetry-information": String
    });
    if ((0, import_internals.isError)(args)) {
      return this.help(args.message);
    }
    if (args._.length === 0 || args["--help"]) {
      return this.help();
    }
    const commandName = args._[0];
    const cmd = this.cmds[commandName];
    if (cmd) {
      let argsForCmd;
      if (commandName === "diff") {
        argsForCmd = args["--preview-feature"] ? [...args._.slice(1), `--preview-feature`] : args._.slice(1);
      } else {
        const filteredArgs = args._.filter((item) => item !== "--preview-feature");
        argsForCmd = filteredArgs.slice(1);
      }
      return cmd.parse(argsForCmd, config, baseDir);
    }
    return (0, import_internals.unknownCommand)(_MigrateCommand.help, commandName);
  }
  help(error) {
    if (error) {
      return new import_internals.HelpError(`
${(0, import_chunk_SKRR5WT4.bold)((0, import_chunk_SKRR5WT4.red)(`!`))} ${error}
${_MigrateCommand.help}`);
    }
    return _MigrateCommand.help;
  }
};
