Run migrations (Postgres → MongoDB)
Damru — Migration scripts are generated under packages/cli/output/scripts/ when you run sql2nosql analyze. That folder is regenerated on each analyze.
Run all migrations with Node
From packages/cli:
bash
cd packages/cli
yarn install # or npm install (ensures pg + mongodb are installed)
node output/scripts/run-all.migrate.jsFrom project root:
bash
node packages/cli/output/scripts/run-all.migrate.jsrun-all.migrate.js runs every collection migration in dependency order (e.g. artist → album → …) and prints ✓ All migrations completed. when done.
Requirements
- Config:
sql2nosql.config.jsonat the project root withconnection,schema, andmongodb.uri/mongodb.database. - Dependencies:
pgandmongodb(installed inpackages/cliwhen you runyarn installthere).
Dry run (no writes)
In sql2nosql.config.json set:
json
"migration": { "dryRun": true }Then run the same command; scripts will connect and process rows but not write to MongoDB.
Run a single collection
bash
cd packages/cli
node output/scripts/album.migrate.jsRun dependency collections first (e.g. artist.migrate.js before album.migrate.js) if you don’t use run-all.