A powerful, single-file C# application that compares database schemas across different environments and generates migration scripts. Supports PostgreSQL, MySQL, SQL Server, and SQLite.
- 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
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)
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| 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 |
Beautiful, colorful console output with rich formatting showing:
- Summary statistics
- Missing, extra, and modified tables
- Detailed column-level differences
Generate production-ready migration scripts:
./schemer.cs ... --output sql --migration-name "update_user_schema"Machine-readable JSON format for integration with other tools:
./schemer.cs ... --output jsonHuman-readable documentation format:
./schemer.cs ... --output markdownpostgres://username:password@hostname:5432/database
Host=hostname;Database=database;Username=username;Password=password
mysql://username:password@hostname:3306/database
Server=hostname;Database=database;Uid=username;Pwd=password
Server=hostname;Database=database;Integrated Security=true
Server=hostname;Database=database;User Id=username;Password=password
Data Source=database.db
Data Source=C:\path\to\database.sqlite
- .NET 10.0 preview
- Database-specific drivers (automatically included via NuGet packages)
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
- Connection string validation with basic SQL injection prevention
- Credential masking in console output
- Timeout handling for long-running operations
- Retry logic with exponential backoff
This is a single-file application designed for simplicity and portability. Contributions are welcome! Please ensure any changes maintain the single-file architecture.