Schemer
Lightning-fast .NET single-file script for database schema comparison and migration generation across PostgreSQL, MySQL, SQL Server, and SQLite
Install / Use
/learn @Tim-Maes/SchemerREADME
🎯 Schemer - Database Schema Diff Tool
A powerful, single-file C# application that compares database schemas across different environments and generates migration scripts. Supports PostgreSQL, MySQL, SQL Server, and SQLite.
✨ Features
- Lightning-fast schema comparison across all major databases
- Beautiful, colorful console output with rich formatting
- Multiple output formats: Console, SQL, JSON, Markdown
- Comprehensive change detection: tables, columns, indexes, constraints
- Production-ready migration script generation
- Zero-installation single-file deployment
🚀 Quick Start
1. Copy the Schemer.cs file to your local machine.
You can clone the repo and put the Schemer.cs file somewhere you like. Make sure you have the NET10 SDK or Runtime installed. (Currently still in preview)
2. Run a schema comparison:
You can run Schemer commands from the terminal.
Example using the test databases provided in this repository:
dotnet run schemer.cs
--source "Data Source=schemer_source.db"
--target "Data Source=schemer_target.db"
--type sqlite
3. Example output
<img width="1994" height="1752" alt="image" src="https://github.com/user-attachments/assets/aa68e281-ac71-468a-baaf-fb15de5acf15" />📋 Command Line Options
| Option | Description | Required | Default |
|--------|-------------|----------|---------|
| --source | Source database connection string | ✅ | - |
| --target | Target database connection string | ✅ | - |
| --type | Database type (postgres, mysql, sqlserver, sqlite) | ✅ | - |
| --output | Output format (console, sql, json, markdown) | ❌ | console |
| --tables | Comma-separated list of specific tables to compare | ❌ | all tables |
| --ignore | Comma-separated list of tables/columns to ignore | ❌ | none |
| --migration-name | Name for generated migration file | ❌ | auto-generated |
| --verbose | Detailed output including debug information | ❌ | false |
📊 Output Formats
Console (Default)
Beautiful, colorful console output with rich formatting showing:
- Summary statistics
- Missing, extra, and modified tables
- Detailed column-level differences
SQL Migration Scripts
Generate production-ready migration scripts:
./schemer.cs ... --output sql --migration-name "update_user_schema"
JSON Reports
Machine-readable JSON format for integration with other tools:
./schemer.cs ... --output json
Markdown Documentation
Human-readable documentation format:
./schemer.cs ... --output markdown
🔧 Connection String Examples
PostgreSQL
postgres://username:password@hostname:5432/database
Host=hostname;Database=database;Username=username;Password=password
MySQL
mysql://username:password@hostname:3306/database
Server=hostname;Database=database;Uid=username;Pwd=password
SQL Server
Server=hostname;Database=database;Integrated Security=true
Server=hostname;Database=database;User Id=username;Password=password
SQLite
Data Source=database.db
Data Source=C:\path\to\database.sqlite
🛠️ Requirements
- .NET 10.0 preview
- Database-specific drivers (automatically included via NuGet packages)
📦 Dependencies
The following NuGet packages are automatically included:
Npgsql- PostgreSQL driverMySqlConnector- MySQL driverMicrosoft.Data.SqlClient- SQL Server driverMicrosoft.Data.Sqlite- SQLite driverDapper- Micro ORMSpectre.Console- Rich console UISystem.CommandLine- Command line parsingNewtonsoft.Json- JSON serialization
🔒 Security Features
- Connection string validation with basic SQL injection prevention
- Credential masking in console output
- Timeout handling for long-running operations
- Retry logic with exponential backoff
🤝 Contributing
This is a single-file application designed for simplicity and portability. Contributions are welcome! Please ensure any changes maintain the single-file architecture.
Related Skills
feishu-drive
339.3k|
things-mac
339.3kManage Things 3 via the `things` CLI on macOS (add/update projects+todos via URL scheme; read/search/list from the local Things database)
clawhub
339.3kUse the ClawHub CLI to search, install, update, and publish agent skills from clawhub.com
yu-ai-agent
2.0k编程导航 2025 年 AI 开发实战新项目,基于 Spring Boot 3 + Java 21 + Spring AI 构建 AI 恋爱大师应用和 ReAct 模式自主规划智能体YuManus,覆盖 AI 大模型接入、Spring AI 核心特性、Prompt 工程和优化、RAG 检索增强、向量数据库、Tool Calling 工具调用、MCP 模型上下文协议、AI Agent 开发(Manas Java 实现)、Cursor AI 工具等核心知识。用一套教程将程序员必知必会的 AI 技术一网打尽,帮你成为 AI 时代企业的香饽饽,给你的简历和求职大幅增加竞争力。
