{"id":18523593,"url":"https://github.com/mongoosejs/migrations","last_synced_at":"2025-04-09T11:31:41.659Z","repository":{"id":144861629,"uuid":"465380344","full_name":"mongoosejs/migrations","owner":"mongoosejs","description":"Mongoose Migration Framework","archived":false,"fork":false,"pushed_at":"2024-10-30T18:34:35.000Z","size":99,"stargazers_count":4,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T05:13:43.067Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mongoosejs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"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},"funding":{"github":"mongoosejs","open_collective":"mongoose","tidelift":"mongoose"}},"created_at":"2022-03-02T16:19:25.000Z","updated_at":"2024-10-30T18:34:39.000Z","dependencies_parsed_at":"2024-10-30T19:35:30.696Z","dependency_job_id":null,"html_url":"https://github.com/mongoosejs/migrations","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongoosejs%2Fmigrations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongoosejs%2Fmigrations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongoosejs%2Fmigrations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongoosejs%2Fmigrations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mongoosejs","download_url":"https://codeload.github.com/mongoosejs/migrations/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248031507,"owners_count":21036417,"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":[],"created_at":"2024-11-06T17:36:24.172Z","updated_at":"2025-04-09T11:31:39.749Z","avatar_url":"https://github.com/mongoosejs.png","language":"JavaScript","funding_links":["https://github.com/sponsors/mongoosejs","https://opencollective.com/mongoose","https://tidelift.com/funding/github/mongoose"],"categories":[],"sub_categories":[],"readme":"# migrations\nMongoose Migration Framework\n\n### Getting Started\n\n```javascript\n// Import the migration framework. Put this import **before** any other imports,\n// except dotenv or other environment configuration\nconst migrations = require('@mongoosejs/migrations');\n\nconst Character = require('./models/character');\nconst mongoose = require('mongoose');\n\nrun().catch(err =\u003e { console.error(err); process.exit(-1); });\n\nasync function run() {\n  await mongoose.connect('mongodb://localhost:27017/migrations_examples');\n  // Tell the migration framework that a migration is starting.\n  // Set `restart` option if you want to restart a previously failed migration.\n  await migrations.startMigration({ restart: process.env.RESTART });\n\n  try {\n    // Put any migration logic here - update, save, eachAsync, etc.\n    await Character.updateMany({}, { $set: { ship: 'USS Enterprise' } });\n  } finally {\n    // Make sure to always call `endMigration()`, even if errors occur\n    await migrations.endMigration();\n    await mongoose.disconnect();\n  }\n}\n```\n\n### UI Setup\n\nYou can run the Migration Framework UI as an executable using the provided `migration-ui` command:\n\n```\nenv PORT=3001 env MONGO_URI=\"mongodb://localhost:27017/mydb\" ./node_modules/.bin/migration-ui\n```\n\nYou can also import the Migration Framework UI to your Express app:\n\n**Note:** you are responsible for securing the Migration Framework UI. There is currently no restrictions on the UI or API: anyone that can access the Migration Framework UI's URL can read migration data.\n**Note:** do **not** run the Migration Framework UI in the same process that runs migrations.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmongoosejs%2Fmigrations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmongoosejs%2Fmigrations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmongoosejs%2Fmigrations/lists"}