{"id":28762767,"url":"https://github.com/stabldev/mangoose-migrate","last_synced_at":"2025-06-17T08:09:12.873Z","repository":{"id":295375598,"uuid":"989865851","full_name":"stabldev/mangoose-migrate","owner":"stabldev","description":"🥭 A lightweight migration tool for Mongoose (MongoDB), inspired by Django's migration system.","archived":false,"fork":false,"pushed_at":"2025-06-09T20:27:38.000Z","size":283,"stargazers_count":1,"open_issues_count":5,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-16T01:41:33.983Z","etag":null,"topics":["cli","migrations","mongodb","mongoose","schema"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/mangoose-migrate","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stabldev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-25T01:59:34.000Z","updated_at":"2025-05-27T07:48:43.000Z","dependencies_parsed_at":"2025-05-25T08:19:27.073Z","dependency_job_id":"65de187e-4df2-43a3-b985-ab9ce129b198","html_url":"https://github.com/stabldev/mangoose-migrate","commit_stats":null,"previous_names":["moonlitgrace/mangoose-migrate","stabldev/mangoose-migrate"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/stabldev/mangoose-migrate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stabldev%2Fmangoose-migrate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stabldev%2Fmangoose-migrate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stabldev%2Fmangoose-migrate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stabldev%2Fmangoose-migrate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stabldev","download_url":"https://codeload.github.com/stabldev/mangoose-migrate/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stabldev%2Fmangoose-migrate/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260318723,"owners_count":22991124,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","migrations","mongodb","mongoose","schema"],"created_at":"2025-06-17T08:09:11.194Z","updated_at":"2025-06-17T08:09:12.849Z","avatar_url":"https://github.com/stabldev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🥭 mangoose-migrate\n\n![NPM Version](https://img.shields.io/npm/v/mangoose-migrate?style=flat-square)\n![GitHub License](https://img.shields.io/github/license/moonlitgrace/mangoose-migrate?style=flat-square)\n![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/moonlitgrace/mangoose-migrate/ci.yml?style=flat-square)\n\nA lightweight migration tool for Mongoose (MongoDB), inspired by Django's migration system.\n\n## Installation\n\n```bash\nnpm i -g mangoose-migrate\n# or local\nnpm i -D mangoose-migrate\n```\n\nOr use directly with npx (recommended):\n\n```bash\nnpx mangoose-migrate [command]\n# pnpm dlx mangoose-migrate [command]\n```\n\n## Getting started with the CLI\n\nBefore you start make sure you setup `.env` file or `mangoose.config.js` config file so you don't need to provide cli arguments on each command.\n\nTo generate a `mangoose.config.js` config file in your project root with default options:\n\n```bash\nnpx mangoose-migrate init\n```\n\nOther CLI commands:\n\n```bash\nnpx mangoose-migrate make \u003cname\u003e # creates a migration file\nnpx mangoose-migrate migrate # run pending migrations\n```\n\n## Configuration\n\n### Option 1: Environment Variables\n\n```bash\nexport MONGODB_URI=\"mongodb://user:pass@localhost:27017/mydb?authSource=admin\"\n```\n\n### Option 2: Config File\n\n```js\n// mangoose.config.js\nexport default {\n  connectionUri: process.env.MONGODB_URI,\n  migrationsPath: \"./migrations\",\n  options: {\n    authSource: \"admin\",\n    retryWrites: true,\n    // ...\n  },\n};\n```\n\n### Option 3: CLI Arguments\n\n```bash\nnpx mangoose-migrate migrate \\\\\n  --connection-uri \"mongodb://localhost:27017/mydb\" \\\\\n  --migrations-path \"./db/migrations\"\n```\n\n### Options\n\n| Key              | Required | Default          | Description                 |\n| ---------------- | -------- | ---------------- | --------------------------- |\n| `connectionUri`  | Yes      | -                | MongoDB connection uri      |\n| `migrationsPath` | No       | `\"./migrations\"` | Path to migration files     |\n| `options`        | No       | `{}`             | Mongoose connection options |\n\n## Migration Example\n\n```js\nimport { Migration } from 'mangoose-migrate/core';\nimport { CreateModel } from 'mangoose-migrate/operations';\n\nexport default class InitialMigration extends Migration {\n  constructor() {\n    super('initial');\n  }\n\n  async up(db) {\n    this.addOperation(\n      new CreateModel('User', {\n        name: { type: String, required: true },\n      }),\n    );\n  }\n}\n```\n\n## Operations\n\n- `CreateModel(modelName, schema)`\n- `AddField(modelName, fieldName, definition)`\n\n## License\n\nMIT. See [LICENSE](LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstabldev%2Fmangoose-migrate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstabldev%2Fmangoose-migrate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstabldev%2Fmangoose-migrate/lists"}