# DDV **Repository Path**: datac/ddv ## Basic Information - **Project Name**: DDV - **Description**: Database Diff & Version Manager - **Primary Language**: Unknown - **License**: MulanPSL-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-05-28 - **Last Updated**: 2026-05-29 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # DDV - Database Diff & Version English | [中文](README.md) ## Introduction DDV (Database Diff & Version) is a database schema comparison and version management tool. It supports multiple mainstream and Chinese domestic databases, provides complete snapshot version chain management, intelligent table classification, schema + data diff, and automatic incremental SQL script generation. ## Features - **Multi-database Support**: MySQL, Oracle, PostgreSQL, TiDB, OpenGauss, Dameng (DM), Kingbase, plus custom JDBC types - **Snapshot Management**: Full database schema snapshots with version chain traceability - **Diff Comparison**: Precise detection of table structure, column, index, constraint changes, plus row-level data diff for DICT/CONFIG/PARAM tables - **Intelligent Classification**: Auto-identify CONFIG, PARAM, DICT, BUSINESS, and SYSTEM tables - **SQL Generation**: Auto-generate incremental migrate, rollback, and backup scripts - **Multiple Interfaces**: CLI tool + Electron desktop client (no JDK required, embedded JRE) - **Cross-platform Packaging**: Windows portable exe, Linux AppImage, macOS dmg ## Project Structure ``` ddv/ ├── ddv-core/ # Core engine (Kotlin/JVM) │ ├── api/ # Javalin HTTP API │ ├── classifier/ # Table classifier │ ├── collector/ # Metadata collector │ │ └── dialect/ # Database dialects (7 built-in + GenericDialect) │ ├── diff/ # Diff engine (schema + data) │ ├── generator/ # SQL generator + FreeMarker templates │ ├── model/ # Data models │ ├── snapshot/ # Snapshot storage (SQLite) │ └── util/ # DdvPaths and utilities ├── ddv-cli/ # CLI tool (Picocli) ├── ddv-ui/ # Electron desktop client (Vue 3 + Element Plus) ├── scripts/ # Build scripts (jlink, release) └── config/ # Default configuration files ``` ## Quick Start ### Prerequisites - JDK 17+ (required for CLI; desktop client has embedded JRE) - Node.js 18+ (only needed for frontend development) ### Build the Project ```bash ./gradlew shadowJar ``` ### Run the CLI ```bash # Add a database connection bin/ddv conn add --name mydb --type mysql --host localhost --port 3306 --database testdb --username root --password secret # Create a snapshot bin/ddv snap create -c mydb --tag v1.0 # Compare two snapshots bin/ddv diff --source --target # Generate migration SQL bin/ddv gen --source --target --type migrate --dialect mysql ``` ### Run the Desktop Client ```bash cd ddv-ui npm install npm run electron:dev ``` ### Build Portable EXE ```bash # Windows one-click build scripts\build-release.ps1 # Linux/macOS scripts/build-release.sh linux ``` Build output is in `ddv-ui/release/`. Data files (db/config/drivers) are created alongside the exe on first run. ### Connection Management The desktop client supports adding, editing, and deleting database connections. Connections must pass a test before saving. Type supports 7 preset databases and custom input (requires adding the corresponding JDBC driver to the `drivers/` directory). ## Data Flow ``` classify auto → snapshot create → diff → generate ↓ ↓ ↓ ↓ table_tags tables_json DiffResult SQL scripts ``` ## Tech Stack | Layer | Technology | |-------|-----------| | Backend | Kotlin 1.9, JDK 17, Javalin 6, HikariCP, FreeMarker, SQLite | | Frontend | Vue 3, Element Plus, Monaco Editor, Pinia | | Desktop | Electron 28, electron-builder | | Build | Gradle 8, shadow plugin, jlink | ## License See [LICENSE](LICENSE)