"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");

var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property");

_Object$defineProperty(exports, "__esModule", {
  value: true
});

exports.handler = exports.builder = exports.desc = exports.command = void 0;

var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/filter"));

var _lib = require("../../lib");

const command = 'save [name..]';
exports.command = command;
const desc = 'Create a new migration.';
exports.desc = desc;
const builder = {
  verbose: {
    type: 'boolean',
    default: true,
    alias: ['v']
  }
};
exports.builder = builder;

const handler = async ({
  name,
  verbose = true
}) => {
  var _context;

  await (0, _lib.runCommandTask)([{
    title: 'Creating database migration...',
    cmd: 'yarn prisma',
    args: (0, _filter.default)(_context = ['migrate save', name && `--name ${name}`, '--experimental']).call(_context, Boolean)
  }], {
    verbose
  });
};

exports.handler = handler;