Auto-gen Mongoose migration scripts
Auto-gen Mongoose migration scripts
Mongeese CLI is a command-line interface tool designed to automate the generation of MongoDB migration scripts. It functions by tracking Mongoose models, detecting changes in their schemas, and subsequently generating versioned MongoDB migration files. This process aims to eliminate the need for manual migration script creation and prevent silent schema drift in production environments. The tool's core capabilities include snapshotting Mongoose schemas upon every change, detecting added, removed, or modified fields, and generating `$set`, `$unset`, and rollback scripts. It organizes these migrations by timestamp, facilitating tracking and potential rollbacks. Mongeese CLI is designed to be compatible with CI/CD and GitOps workflows. Typical use cases involve speeding up development in projects utilizing NestJS and Mongoose, though the tool is framework-agnostic. It requires Node.js version 18 or higher and Mongoose version 7 or higher to operate. The tool can be installed globally via npm or yarn, or used directly with npx.