migrate is the main cross-database migration command. DBDock analyzes the source, generates a schema mapping, shows it to you, and waits for confirmation before touching anything.
Run
dbdock analyze on the source first. It’s read-only and tells you what you’re about to migrate.Examples
MongoDB → PostgreSQL
PostgreSQL → MongoDB
Options
The confirmation flow
What happens under the hood
1
Connect to both databases
Validates credentials and reachability.
2
Analyze source
Same logic as
dbdock analyze — types, nesting, inconsistencies.3
Generate mapping
Proposes target schema based on source shape and
--max-depth.4
Detect references
Scans for fields that look like references between collections/tables.
5
Show plan and wait
Nothing is written yet. You see the full plan and confirm.
6
Create target schema
Creates tables/collections. Idempotent — skips existing ones.
7
Migrate in batches
Streams data in configurable batches. Progress bar shows rate and ETA.
8
Collect errors
Failed rows go to
_migration_errors with the error message.9
Report
Summary: rows migrated, rows failed, duration.
Reusing a mapping
Generate and save the plan once:Tuning
Large collections
If a collection has millions of documents, lower the batch size to reduce memory and increase the commit frequency:Deeply nested documents
If your documents have complex nesting you don’t want flattened, increase--max-depth — but past depth 2 or 3, you’re usually better off with jsonb:
jsonb — usually the right default.
See also
Dry runs
Validate before committing.
Schema mapping
Type conversion details.
Incremental
Pull only new/changed data.

