npx
npx migratoryai --help
Best for trying the CLI quickly with no global install.
Documentation
MigratoryAI is a CLI package for analyzing NoSQL data, inferring SQL-ready structure, previewing migration output, migrating in batches, validating results, and parsing log files into structured documents.
Install
npx migratoryai --help
Best for trying the CLI quickly with no global install.
npm install -g migratoryai
Best for regular use across projects and migration workflows.
Quick start
migratoryai target-check
migratoryai analyze --entity users --limit 5
migratoryai migrate --entity users --limit 500 --batch-size 100 --validate
Commands
Fetch sample source data, infer the relational shape, and print SQL suggestions.
Move source data into SQL with batching, retries, and optional validation.
Compare expected row counts from source data against the SQL target.
Verify target database connectivity before running migrations. `pg-check` remains as an alias.
Parse a log file into structured documents and route output to JSON, PostgreSQL, or MongoDB. Use --llm-fallback for AI-powered parsing of ambiguous lines.
Log ingestion
migratoryai ingest logs.txt
Parses the log file and writes structured JSON to a file named logs-parsed.json in the current directory.
migratoryai ingest logs.txt --llm-fallback
Retries unparsed lines with AI Haiku. Requires ANTHROPIC_API_KEY to be set.
migratoryai ingest logs.txt --output postgres
migratoryai ingest logs.txt --output mongo --collection app_logs
migratoryai ingest logs.txt --output ./out/parsed.json
Where to send parsed documents. Accepts json (default), postgres, mongo, or a direct file path. When json is used without a path, output defaults to <input-name>-parsed.json.
Collection or table name for the parsed output. Defaults to logs.
Retry lines the regex parser cannot handle using AI Haiku. Requires ANTHROPIC_API_KEY. Lines that still cannot be parsed are preserved in the unparsed list.
{
"level": "ERROR",
"event": "payment_failed",
"user_id": "123",
"timestamp": "2026-05-13T10:34:22.000Z",
"raw_message": "[ERROR] event=payment_failed user_id=123"
}
Required when using --llm-fallback. AI Haiku is used to parse log lines the regex engine cannot structure.
Optional model override for the AI fallback parser. Defaults to claude-haiku-4-5-20251001.
Configuration
{
"source": {
"type": "mongodb",
"uri": "mongodb://127.0.0.1:27017",
"dbName": "sample_mflix",
"entityName": "users",
"collectionName": "users"
},
"target": {
"type": "postgres",
"host": "127.0.0.1",
"port": 5432,
"user": "postgres",
"password": "postgres",
"database": "migratoryai"
},
"options": {
"limit": 1000,
"batchSize": 250,
"retries": 3,
"validate": true
}
}
CLI flags override config-file values, and config values override environment fallbacks.
Safety