DbShift 2.0.1
dotnet tool install --global DbShift --version 2.0.1
dotnet new tool-manifest
dotnet tool install --local DbShift --version 2.0.1
#tool dotnet:?package=DbShift&version=2.0.1
nuke :add-package DbShift --version 2.0.1
<div align="center">
<img src="https://raw.githubusercontent.com/AzimMahmud/dbshift/main/.github/assets/icon.svg" alt="DbShift" width="120">
DbShift
Database migrations that ship.
A Flyway-style migration tool for PostgreSQL, SQL Server, MySQL, and SQLite.
<br>
Documentation · Report Bug · Request Feature
</div>
What is DbShift?
DbShift is a SQL-first database migration tool for .NET. You write plain .sql files, and DbShift tracks, validates, and applies them across environments — with built-in safety features for production use.
Why not Entity Framework migrations? EF migrations are tightly coupled to your application code and hard to control in production. DbShift keeps migrations as standalone SQL files that live in your repository, work with any language or framework, and give you full control over what runs and when.
Features
- SQL-first — Plain
.sqlfiles. No embedded DSL, no XML, no surprises. - Multi-database — PostgreSQL, SQL Server, MySQL, and SQLite. Switch providers without changing your workflow.
- Safe by design — Distributed locks, approval gates, deployment windows, and audit trails.
- CI-friendly — Every command supports
--jsonoutput and deterministic exit codes. - Works offline — Validate, plan, and scaffold without a database connection.
- Checksum integrity — SHA-256 checksums detect when previously-applied scripts are edited in place.
Quick Start
# Install (no .NET required)
curl -fsSL https://github.com/AzimMahmud/dbshift/releases/latest/download/install.sh | bash
# Scaffold a project
dbshift new --name MyApp --provider postgresql
# Create a migration
dbshift create --name CreateUsersTable --type schema
# Validate & preview
dbshift validate
dbshift plan
# Deploy
dbshift migrate -c "Host=localhost;Database=myapp;Username=postgres"
Installation
No .NET SDK or runtime required — the binary is self-contained.
# Linux / macOS
curl -fsSL https://github.com/AzimMahmud/dbshift/releases/latest/download/install.sh | bash
# Windows (PowerShell)
powershell -c "iwr -Uri https://github.com/AzimMahmud/dbshift/releases/latest/download/install.ps1 | iex"
# .NET global tool (requires .NET 10 SDK)
dotnet tool install --global DbShift
Manual Download
| Platform | Download |
|---|---|
| Windows x64 | dbshift-windows-x64.zip |
| Linux x64 | dbshift-linux-x64.tar.gz |
| Linux arm64 | dbshift-linux-arm64.tar.gz |
| macOS x64 | dbshift-macos-x64.tar.gz |
| macOS arm64 | dbshift-macos-arm64.tar.gz |
Commands
| Command | Description | DB Required |
|---|---|---|
new |
Scaffold a complete project | No |
create |
Create a migration script | No |
validate |
Check scripts for errors | No |
plan |
Preview execution plan | No |
info |
Show configuration | No |
init |
Create tracking tables | Yes |
migrate |
Apply pending migrations | Yes |
status |
Show migration status | Yes |
rollback |
Undo migrations | Yes |
repair |
Fix failed migrations | Yes |
history |
View audit trail | Yes |
Run dbshift <command> --help for command-specific options.
Configuration
DbShift uses a two-tier JSON configuration:
// Database/Config/migration.json
{
"migration": {
"database": {
"provider": "postgresql",
"connectionString": "${DB_CONNECTION_STRING}"
},
"scripts": {
"path": "./Database/Migrations"
},
"execution": {
"batchSize": 10,
"stopOnFailure": true
}
}
}
Per-environment overrides in Database/Config/environments/<name>.json with ${VAR} expansion for secrets. See the Configuration Guide for details.
Supported Databases
| Provider | Version | Config Value |
|---|---|---|
| PostgreSQL | 12+ | postgresql |
| SQL Server | 2016+ | sqlserver |
| MySQL / MariaDB | 8+ / 10.5+ | mysql |
| SQLite | 3 | sqlite |
Documentation
Full documentation is available at azimmahmud.github.io/dbshift.
Building from Source
git clone https://github.com/AzimMahmud/dbshift.git
cd dbshift
dotnet build DbShift.slnx
dotnet test DbShift.slnx --filter "Category!=Integration"
Requires the .NET 10 SDK.
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.
| Version | Downloads | Last Updated |
|---|