dotnet-db-migrate 2.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global dotnet-db-migrate --version 2.1.0                
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 dotnet-db-migrate --version 2.1.0                
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=dotnet-db-migrate&version=2.1.0                
nuke :add-package dotnet-db-migrate --version 2.1.0                

A CLI that adds and migrates database migrations for MS SQL and PostgreSQL.

Quick Start

Installation

dotnet tool install -g dotnet-db-migrate

Example Usage

$ dotnet db add-migration "AddContactsTable"
Added migration script ./20200520180400_AddContactsTable.sql

You would then add the SQL for the migration.

eg, for PostgreSQL.

CREATE EXTENSION pgcrypto;
CREATE TABLE contacts(
  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  name TEXT,
  email TEXT
);

Then you can execute the migration using the following command,

$ dotnet db migrate "Server=localhost;Port=5432;Database=db-migrate;User Id=postgres;Password=password;" -p psql`
Master ConnectionString => Host=localhost;Port=5432;Database=db-migrate;Username=postgres;Password=********
Created database db-migrate
Beginning database upgrade
Checking whether journal table exists..
Journal table does not exist
Executing Database Server script '20200520180400_AddContactsTable.sql'
Checking whether journal table exists..
Creating the "schemaversions" table
The "schemaversions" table has been created
Upgrade successful
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp3.1 is compatible. 
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
2.2.2 709 11/9/2021
2.2.1 414 11/9/2021
2.2.0 421 11/9/2021
2.1.0 621 5/20/2020
1.0.0 996 9/13/2018