UNPKG

@mongez/gnz

Version:

Generator Z, the next generation of scaffolding tools.

21 lines (20 loc) 1.44 kB
'use strict';var commander=require('commander'),path=require('path'),index=require('../../index.js'),main=require('../../../../main.js');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var path__default=/*#__PURE__*/_interopDefault(path);const mongodbMigrationCommand = new commander.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, indexes, unique, text, geo } = options; await main.gnz.execute(index.generateMongoDBMigration.execute({ name, saveTo: path__default.default.resolve(process.cwd(), path || ""), modelClass: model, index: indexes ? indexes.split(",") : [], unique: unique ? unique.split(",") : [], text: text ? text.split(",") : [], geo: geo ? geo.split(",") : [], })); });exports.mongodbMigrationCommand=mongodbMigrationCommand;//# sourceMappingURL=mongodb-migration-command.js.map