mvdmio.Database.PgSQL.Tool 0.20.5

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global mvdmio.Database.PgSQL.Tool --version 0.20.5
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local mvdmio.Database.PgSQL.Tool --version 0.20.5
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=mvdmio.Database.PgSQL.Tool&version=0.20.5
                    
nuke :add-package mvdmio.Database.PgSQL.Tool --version 0.20.5
                    

mvdmio.Database.PgSQL.Tool

CLI workflow for PostgreSQL migrations and schema files.

Install the package as a dotnet tool and use the db command to scaffold migrations, apply them, export schema files, and clean up old migration sources.

Installation

Install globally:

dotnet tool install --global mvdmio.Database.PgSQL.Tool

Or install locally to a tool manifest:

dotnet new tool-manifest
dotnet tool install mvdmio.Database.PgSQL.Tool

After installation, run the tool as db.

Targets net8.0, net9.0, and net10.0.

Quick Start

db init
db migration create AddUsersTable
db migrate latest
db pull

Main Commands

db init

Creates a .mvdmio-migrations.yml file in your project.

db migration create <name>

Creates a timestamped migration class you can fill in with SQL.

Example:

db migration create AddUsersTable

db migrate latest

Applies all pending migrations.

db migrate latest
db migrate latest --environment prod
db migrate latest --connection-string "Host=localhost;Database=mydb;Username=postgres;Password=secret"

db migrate to <identifier>

Applies migrations up to a specific version.

db migrate to 202602161430

db pull

Exports the current database schema to a SQL file.

db pull
db pull --environment prod

By default, schema files are written into Schemas/.

db cleanup

Refreshes schema files for configured environments and removes migrations that are older than every retained schema version.

db cleanup

Configuration

The tool uses .mvdmio-migrations.yml.

project: src/MyApp.Data
migrationsDirectory: Migrations
schemasDirectory: Schemas
connectionStrings:
  local: Host=localhost;Database=mydb;Username=postgres;Password=secret
  acc: Host=acc-server;Database=mydb;Username=postgres;Password=secret
  prod: Host=prod-server;Database=mydb;Username=postgres;Password=secret

Connection strings are resolved in this order:

  1. --connection-string
  2. --environment or -e
  3. First entry in connectionStrings

Typical Workflow

db init
db migration create AddOrdersTable
db migrate latest --environment local
db pull --environment local

Companion Library

This tool is designed to work with mvdmio.Database.PgSQL.

License

MIT. See ../../LICENSE.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
0.29.0 0 6/11/2026
0.28.0 48 6/10/2026
0.27.0 45 6/9/2026
0.26.1 93 6/5/2026
0.26.0 104 4/27/2026
0.25.0 97 4/19/2026
0.24.1 102 4/16/2026
0.24.0 104 4/15/2026
0.23.14 102 4/14/2026
0.23.13 103 4/14/2026
0.23.12 99 4/14/2026
0.23.11 92 4/14/2026
0.20.9 103 4/14/2026
0.20.8 104 4/11/2026
0.20.7 104 4/11/2026
0.20.5 101 4/9/2026
0.20.4 104 4/9/2026
0.20.0 101 4/9/2026
0.19.2 119 4/1/2026
0.19.0 109 3/26/2026
Loading failed