Skip to content
iamvirul edited this page Mar 31, 2026 · 4 revisions

DeepDiff DB Wiki

Safe, deterministic, reviewable database synchronization — across MySQL, PostgreSQL, SQLite, MSSQL, and Oracle.

DeepDiff DB compares two databases (production vs. development) at both the schema and row level, detects every difference, and generates a transactional migration pack you can review before applying.


Navigation

Page Description
Problem Statement What problem DeepDiff DB solves and why it exists
Architecture Overview System design, layers, and module map
Data Flow End-to-end workflow from diff to apply
Schema Layer Schema introspection, diffing, and migration generation
Content Layer Row hashing, pack generation, and pack application
Checkpoint & Resume How interrupted operations can be safely resumed
Conflict Resolution Strategies for rows that exist in both databases but differ
Driver Support Supported databases, DSN formats, and driver details
CLI Reference All commands, flags, and examples
Configuration Reference Full YAML config schema with field descriptions
HTML Reports Interactive diff reports generated with --html
Git-Like Versioning Commit diff snapshots, manage branches, visualise history, generate rollback SQL
Contributing Dev setup, test strategy, and PR guidelines

Quick Start

# Install
brew tap iamvirul/deepdiff-db
brew install deepdiff-db

# Create config
cat > deepdiffdb.yaml <<EOF
prod:
  driver: mysql
  host: prod-db.example.com
  port: 3306
  user: readonly
  password: secret
  database: myapp

dev:
  driver: mysql
  host: localhost
  port: 3306
  user: root
  password: root
  database: myapp
EOF

# Check connectivity
deepdiff-db check --config deepdiffdb.yaml

# Run full diff
deepdiff-db diff --config deepdiffdb.yaml --html

# Generate migration pack
deepdiff-db gen-pack --config deepdiffdb.yaml

# Apply (dry run first)
deepdiff-db apply --pack ./diff-output/migration_pack.sql --dry-run
deepdiff-db apply --pack ./diff-output/migration_pack.sql

Key Features

  • Schema diff — detects added/removed tables, column type changes, index and foreign key drift
  • Row-level diff — SHA-256 hashes every row; finds added, removed, and updated rows without full data export
  • Keyset pagination — streams arbitrarily large tables with bounded memory usage
  • Transactional apply — migration packs execute atomically; automatic rollback on error
  • Checkpoint/resume — interrupted operations pick up exactly where they left off
  • Conflict resolution — per-table strategies (ours, theirs, manual) for rows that diverged in both databases
  • HTML reports — interactive tab-based report with schema diff, row diffs, conflict viewer, and SQL preview
  • Git-like versioning — commit diff snapshots, create branches, visualise history with ASCII tree, generate rollback SQL offline
  • Multi-database — MySQL, PostgreSQL, SQLite, MSSQL, Oracle

Clone this wiki locally