@mongez/gnz
Version:
Generator Z, the next generation of scaffolding tools.
21 lines (20 loc) • 1.28 kB
JavaScript
import {Command}from'commander';import path from'path';import {generateMongoDBMigration}from'../../index.js';import {gnz}from'../../../../main.js';const mongodbMigrationCommand = new Command("gn:migration")
.arguments("<name>")
.option("-p, --path <path>", "Save to path, relative to root directory")
.requiredOption("-m, --model <name>", "Model class name")
.option("-i, --indexes <indexes>", "Column that will be indexed, separate with comma")
.option("-u, --unique <unique>", "Column that will be unique, separate with comma")
.option("-t, --text <text>", "Column that will be text indexed, separate with comma")
.option("-g, --geo <geo>", "Column that will be geo indexed, separate with comma")
.action(async (name, options) => {
const { model, path: path$1, indexes, unique, text, geo } = options;
await gnz.execute(generateMongoDBMigration.execute({
name,
saveTo: path.resolve(process.cwd(), path$1 || ""),
modelClass: model,
index: indexes ? indexes.split(",") : [],
unique: unique ? unique.split(",") : [],
text: text ? text.split(",") : [],
geo: geo ? geo.split(",") : [],
}));
});export{mongodbMigrationCommand};//# sourceMappingURL=mongodb-migration-command.js.map