Corely.Billing.DataAccessMigrations.Cli 3.0.0

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

Corely Billing Database Migration CLI

Creates and migrates the Corely Billing database schema. This is the supported way to stand up the billing tables. The library itself never applies migrations at runtime.

The tool ships both provider migration sets, so nothing beyond it needs to be referenced.

Provider Value
SQL Server MsSql
MySQL MySql

Install

dotnet tool install --global Corely.Billing.DataAccessMigrations.Cli

The command is corely-billing-db.

The tool's major version tracks the library's: CLI 1.x targets Corely.Billing 1.x. Minor and patch versions move independently, since most library releases add no migrations.

Configuration

Every db command takes the provider and connection string as options, falling back to environment variables:

Option Environment variable
-p, --provider CORELY_BILLING_DB_PROVIDER
-c, --connection-string CORELY_BILLING_DB_CONNECTION

The option wins when both are present. There is no settings file: an installed tool would have to keep one in its own install directory, shared by every repository and CI job on the machine.

# Per invocation
corely-billing-db db create -p MsSql -c "Server=(localdb)\MSSQLLocalDB;Database=MyApp;Trusted_Connection=True;"

# Or once per shell
export CORELY_BILLING_DB_PROVIDER=MsSql
export CORELY_BILLING_DB_CONNECTION="Server=(localdb)\MSSQLLocalDB;Database=MyApp;Trusted_Connection=True;"
corely-billing-db db create
$env:CORELY_BILLING_DB_PROVIDER = "MsSql"
$env:CORELY_BILLING_DB_CONNECTION = "Server=(localdb)\MSSQLLocalDB;Database=MyApp;Trusted_Connection=True;"
corely-billing-db db create

Commands

Command Description
db create Create the database and apply all migrations
db migrate [target] Apply pending migrations, or migrate to a specific target (0 reverts all)
db status Show applied and pending migrations
db list List all available migrations
db script [from] [to] Generate a SQL script from migrations
db drop [-f] Drop the database (-f skips confirmation)
db test-connection Test the database connection
provider list List available database providers

db status and db list take -a, --show-all to include migrations belonging to other contexts in the same database. db script takes -o, --output to write to a file and -i, --idempotent for a script that is safe to run repeatedly.

Migrations history table

Billing records its migrations in __CorelyBillingMigrationsHistory rather than the default __EFMigrationsHistory, so it can share a database with Corely.IAM and your own contexts without their migration records interleaving.

--history-table overrides the table for every db command:

corely-billing-db db migrate --history-table __MyBillingHistory

Use the same value on every command against that database, or the tool will see every migration as pending and try to recreate tables that already exist.

Examples

# First-time setup
corely-billing-db db create -p MsSql -c "<connection string>"

# Deployment script, reviewed before it runs anywhere
corely-billing-db db script -i -o deploy.sql -p MsSql

# CI or a test fixture with a container-assigned connection string
CORELY_BILLING_DB_PROVIDER=MsSql CORELY_BILLING_DB_CONNECTION="$CONN" corely-billing-db db create

db script needs a provider but never opens a connection, so it works offline.

Authoring migrations

Creating migrations is a development task that needs the repository, not this tool. Use the scripts at the repository root, which target both providers:

.\AddMigration.ps1 "MigrationName"
.\RemoveMigration.ps1
.\ListMigrations.ps1

Notes

  • db create is safe to run against an existing database. It applies whatever is pending.
  • db migrate 0 reverts all migrations but does not drop the database.
  • db drop is destructive and cannot be undone.
Product 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. 
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
7.0.0 64 11/15/2026
6.0.0 69 11/14/2026
5.0.0 127 11/4/2026
4.0.0 135 10/27/2026
3.0.1 105 10/25/2026
3.0.0 104 10/25/2026
2.1.0 124 10/18/2026
2.0.4 123 10/16/2026
2.0.3 118 10/13/2026
2.0.1 110 10/11/2026
2.0.0 135 9/26/2026
1.0.0 124 9/24/2026
1.0.0-preview.1 88 9/23/2026