Samples
The samples/ directory in the repository contains 16 self-contained example projects. Each sample demonstrates a specific feature or database workflow with a working configuration, seed data, and a Makefile with ready-to-run targets.
All Samples
| # | Name | Description | Databases | Docker |
|---|---|---|---|---|
| 01 | basic-diff | Basic schema drift detection and data diff with MySQL | MySQL | Yes |
| 02 | postgres-diff | PostgreSQL diff with advanced migration scenarios | PostgreSQL | Yes |
| 03 | sqlite-diff | SQLite diff with full schema migration workflow | SQLite | No |
| 04 | drop-column-safety | DROP COLUMN with safety controls and allow flags | SQLite | No |
| 05 | modify-column | MODIFY COLUMN: type changes, nullability, defaults | SQLite | No |
| 06 | index-support | Index operations: create, drop, unique indexes | SQLite | No |
| 07 | table-operations | CREATE TABLE and DROP TABLE detection | SQLite | No |
| 08 | foreign-key-support | Foreign key add, drop, and constraint handling | SQLite | No |
| 09 | dependency-ordering | Correct migration ordering for FK dependencies | SQLite | No |
| 10 | conflict-detection | Conflict detection: same PK, different values | SQLite | No |
| 11 | resolution-engine | Conflict resolution engine with ours/theirs strategies | SQLite | No |
| 12 | interactive-resolution | Interactive resolve-conflicts command walkthrough | SQLite | No |
| 13 | html-report-viewer | HTML report generation with --html flag | SQLite | No |
| 14 | streaming-large-datasets | Large dataset streaming with batch-size and parallel flags | SQLite | No |
| 15 | mssql-support | Full MSSQL workflow: schema diff, data diff, gen-pack, apply | MSSQL | Yes |
| 16 | oracle-support | Full Oracle workflow: schema drift, data diff, gen-pack, apply | Oracle | Yes |
Running a SQLite Sample
SQLite samples have no external dependencies. From the project root:
cd samples/03-schema-migrations
make diff
make gen-pack
Running a Docker Sample
MySQL, PostgreSQL, MSSQL, and Oracle samples require Docker and Docker Compose.
# MySQL example
cd samples/01-basic-schema-drift
make up # start containers
make seed # load schema and data
make diff # run deepdiffdb diff
make gen-pack # generate migration pack
make down # stop and remove containers
Sample 14: Streaming Large Datasets
Sample 14 includes a Go seed script that generates 500,000 orders, 100,000 products, and 200,000 audit log rows in SQLite to demonstrate the performance impact of batch size and parallelism settings:
cd samples/14-streaming-large-datasets
make seed # generate ~800k rows
make diff # hash with default settings (batch=10000, parallel=1)
make diff-fast # hash with batch=5000, parallel=4
make diff-sequential # hash with batch=0 (full scan, pre-v0.7 behaviour)
Sample 16: Oracle Support
Sample 16 starts two Oracle XE 21c containers (prod on port 1521, dev on port 1522) using the gvenzl/oracle-xe:21-slim-faststart image and seeds them with schema and data drift:
cd samples/16-oracle-support
make up # start Oracle containers (takes ~60s for XE to initialise)
make wait-healthy # wait for both containers to be ready
make seed # run SQLPlus init scripts
make diff # run deepdiffdb diff
make gen-pack # generate migration pack
make down # stop containers