@clscripts/prisma
Version:
prisma clscripts implementation
46 lines • 1.51 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Prisma = void 0;
class Prisma {
constructor(opts) {
this.packageExecutable = 'prisma';
this.mode = opts.mode;
this.migrationName = opts.migrationName;
this.createOnly = opts.createOnly;
this.forceReset = opts.forceReset;
this.studioPort = opts.studioPort;
}
get command() {
return [this.packageExecutable, this.modeArg].filter(Boolean).join(' ');
}
get modeArg() {
switch (this.mode) {
case 'push':
return [`db push`, this.forceResetArg].join(' ');
case 'seed':
return [`db seed`].join(' ');
case 'migrate':
return [`migrate dev`, this.migrationNameArg, this.createOnlyArg].join(' ');
case 'deploy':
return `migrate deploy`;
case 'studio':
return [`studio`, this.studioPortArg].join(' ');
default:
return this.mode;
}
}
get migrationNameArg() {
return this.migrationName ? `--name ${this.migrationName}` : '';
}
get createOnlyArg() {
return this.createOnly ? `--create-only` : '';
}
get forceResetArg() {
return this.forceReset ? `--force-reset` : '';
}
get studioPortArg() {
return this.studioPort ? `--port ${this.studioPort}` : '';
}
}
exports.Prisma = Prisma;
//# sourceMappingURL=script.js.map