Corely.IAM.DataAccessMigrations.Cli
1.0.0
See the version list below for details.
dotnet tool install --global Corely.IAM.DataAccessMigrations.Cli --version 1.0.0
dotnet new tool-manifest
dotnet tool install --local Corely.IAM.DataAccessMigrations.Cli --version 1.0.0
#tool dotnet:?package=Corely.IAM.DataAccessMigrations.Cli&version=1.0.0
nuke :add-package Corely.IAM.DataAccessMigrations.Cli --version 1.0.0
Corely IAM Database Migration CLI
Creates and migrates the Corely IAM database schema. This is the supported way to stand up the IAM 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.IAM.DataAccessMigrations.Cli
The command is corely-iam-db.
Configuration
Every db command takes the provider and connection string as options, falling back to environment
variables:
| Option | Environment variable |
|---|---|
-p, --provider |
CORELY_IAM_DB_PROVIDER |
-c, --connection-string |
CORELY_IAM_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-iam-db db create -p MsSql -c "Server=(localdb)\MSSQLLocalDB;Database=CorelyIam;Trusted_Connection=True;"
# Or once per shell
export CORELY_IAM_DB_PROVIDER=MsSql
export CORELY_IAM_DB_CONNECTION="Server=(localdb)\MSSQLLocalDB;Database=CorelyIam;Trusted_Connection=True;"
corely-iam-db db create
$env:CORELY_IAM_DB_PROVIDER = "MsSql"
$env:CORELY_IAM_DB_CONNECTION = "Server=(localdb)\MSSQLLocalDB;Database=CorelyIam;Trusted_Connection=True;"
corely-iam-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
IAM records its migrations in __CorelyIamMigrationsHistory rather than the default
__EFMigrationsHistory, so it can share a database with your own contexts without their migration
records interleaving.
A database that was migrated before this default existed has its IAM history in
__EFMigrationsHistory. Either keep using it:
corely-iam-db db migrate --history-table __EFMigrationsHistory
or copy the records across once and drop the option:
-- SQL Server
SELECT * INTO __CorelyIamMigrationsHistory FROM __EFMigrationsHistory;
-- MySQL
CREATE TABLE __CorelyIamMigrationsHistory AS SELECT * FROM __EFMigrationsHistory;
That copies everything, which is what you want when IAM is the only context in the database. If it
shares the database, restrict the copy to the migration ids corely-iam-db db list reports.
Run db status afterwards: every IAM migration should read as applied. If they read as pending,
the copy did not land and migrating would try to recreate tables that already exist.
Examples
# First-time setup
corely-iam-db db create -p MsSql -c "<connection string>"
# Deployment script, reviewed before it runs anywhere
corely-iam-db db script -i -o deploy.sql -p MsSql
# CI or a test fixture with a container-assigned connection string
CORELY_IAM_DB_PROVIDER=MsSql CORELY_IAM_DB_CONNECTION="$CONN" corely-iam-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 createis safe to run against an existing database — it applies whatever is pending.db migrate 0reverts all migrations but does not drop the database.db dropis destructive and cannot be undone.
| 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 |
|---|---|---|
| 7.3.0 | 72 | 11/16/2026 |
| 7.2.0 | 114 | 11/9/2026 |
| 7.1.0 | 97 | 11/9/2026 |
| 7.0.0 | 101 | 11/8/2026 |
| 6.2.0 | 132 | 11/1/2026 |
| 6.1.0 | 118 | 10/27/2026 |
| 6.0.1 | 109 | 10/27/2026 |
| 6.0.0 | 103 | 10/27/2026 |
| 5.0.0 | 149 | 10/16/2026 |
| 4.0.1 | 123 | 10/13/2026 |
| 4.0.0 | 105 | 10/12/2026 |
| 3.1.1 | 109 | 10/11/2026 |
| 3.1.0 | 119 | 10/10/2026 |
| 3.1.0-preview.1 | 79 | 10/4/2026 |
| 3.0.0 | 123 | 10/2/2026 |
| 2.1.0 | 109 | 10/1/2026 |
| 2.0.2 | 123 | 9/25/2026 |
| 2.0.1 | 143 | 9/7/2026 |
| 2.0.0 | 125 | 9/4/2026 |
| 1.0.0 | 128 | 9/4/2026 |