SchemaForge.Abstractions 2.1.1

dotnet add package SchemaForge.Abstractions --version 2.1.1
                    
NuGet\Install-Package SchemaForge.Abstractions -Version 2.1.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SchemaForge.Abstractions" Version="2.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SchemaForge.Abstractions" Version="2.1.1" />
                    
Directory.Packages.props
<PackageReference Include="SchemaForge.Abstractions" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SchemaForge.Abstractions --version 2.1.1
                    
#r "nuget: SchemaForge.Abstractions, 2.1.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SchemaForge.Abstractions@2.1.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SchemaForge.Abstractions&version=2.1.1
                    
Install as a Cake Addin
#tool nuget:?package=SchemaForge.Abstractions&version=2.1.1
                    
Install as a Cake Tool

Build NuGet NuGet Downloads License

SchemaForge

A high-performance Cross-Database Migration Engine for .NET that ports schemas and data between different database vendors. Designed for enterprise-scale modernizations, SchemaForge handles complex views, cross-schema foreign keys, and massive datasets with ease.


πŸ’‘ Engine vs. Tool: When to use SchemaForge?

It is important to distinguish SchemaForge from "Schema Evolution" tools like Liquibase or Flyway:

  • Liquibase / Flyway are for Version Control. Use them to manage incremental changes (v1 β†’ v2) within the same database vendor over time.
  • SchemaForge is a Porting Engine. Use it to move an entire system from one vendor to another (e.g., SQL Server β†’ PostgreSQL). It automates the complex translation of data types, SQL dialects for views, and handling of legacy data orphans.

Supported Databases

  • SQL Server (source and target)
  • PostgreSQL (source and target)
  • MySQL (source and target)
  • Oracle (source and target)

Features

  • Robust Schema Migration - Automatic creation of tables, primary keys, and complex foreign key relationships across all 4 platforms.
  • Enterprise-Grade Constraints - Implements "Future Enforcement, Past Forgiveness" model using ENABLE NOVALIDATE (Oracle), NOT VALID (Postgres), and WITH NOCHECK (SQL Server) to ensure migrations complete even with legacy data orphans.
  • Automated Infrastructure - Automatically creates target databases, schemas, and Oracle users/permissions on-the-fly.
  • High-Performance Data Transfer - Parallel table migration with batched bulk writes, read-ahead pipelines, and sql_log_bin=0 (MySQL) for maximum speed and disk efficiency.
  • Intelligent View Migration - Sophisticated SQL dialect conversion for view definitions, handling complex functions like DECODE, BITAND, SYSDATETIME, and varied quoting styles.
  • Verified with WideWorldImporters - Stress-tested and verified using the full, multi-schema production dataset from Microsoft.
  • Plugin-Based Architecture - Fully extensible provider model built on .NET 9 and standard interfaces.
  • Dry Run Mode - Generate and preview complete migration SQL scripts without executing against the target.

Quick Start

Install as a .NET global tool

# Install from NuGet
dotnet tool install --global SchemaForge.Cli

# Run a migration
schemaforge --from postgres --to oracle \
  --source-conn "Host=127.0.0.1;Database=prod;Username=pg;Password=..." \
  --target-conn "User Id=system;Password=...;Data Source=127.0.0.1:1521/FREEPDB1" \
  --schema SALES --verbose

Use as a library in your .NET app

dotnet add package SchemaForge
dotnet add package SchemaForge.Providers.SqlServer
dotnet add package SchemaForge.Providers.Postgres
using SchemaForge.Builder;

await DbMigrate
    .FromSqlServer(srcConn)
    .ToPostgres(targetConn, "public")
    .MigrateAll()
    .WithMaxParallelTables(4)
    .ExecuteAsync();

CLI Usage

Option Type Default Description
--from string - Source DB type: sqlserver, postgres, mysql, oracle
--to string - Target DB type: sqlserver, postgres, mysql, oracle
--schema string public Target schema name
--parallel int 4 Max parallel table migrations
--batch-size int 10000 Rows per batch
--drop-target flag false Wipe target schemas before starting
--preserve-names flag false Retain source identifiers as-is instead of converting to target DB naming convention

Data Type Mapping

SQL Server PostgreSQL MySQL Oracle
tinyint boolean TINYINT(1) NUMBER(3)
bit boolean TINYINT(1) NUMBER(1)
varchar(n) character varying(n) VARCHAR(n) VARCHAR2(n)
datetime2 timestamp DATETIME TIMESTAMP

Changelog

v2.1.1 β€” Resource Leak & FK Naming Fixes

  • MigrationBuilder ServiceProvider Disposal β€” ExecuteAsync now disposes the ServiceProvider (and its connection pool) in a finally block. Previously, calling ExecuteAsync in a loop (e.g., once per schema) accumulated undisposed pools, causing connection exhaustion on large multi-schema migrations.
  • Batch DataTable Disposal β€” BulkDataMigrator disposes each batch DataTable immediately after the write step instead of waiting for GC. Eliminates memory growth proportional to total row count on large datasets.
  • FK Naming Double-Conversion Fixed β€” SqlServerSchemaWriter.GenerateAddForeignKeySql was applying namingConverter.Convert() to the FK name after prepending FK_, resulting in FK_FK_ prefixes on round-trip migrations. The second convert call is removed; the name is final after prefix prepending.
  • SqlServerDataReader COUNT(*) Timeout β€” GetRowCountAsync now sets CommandTimeout = 0 (unlimited) to handle large tables whose cold-scan COUNT(*) exceeds the 30-second default.
  • docker-compose.test.yml β€” Switched SQL Server image from azure-sql-edge to mssql/server:2022-latest; capped memory at 2 GB; updated healthcheck to mssql-tools18 path.
  • SchemaForge.IntegrationTests β€” New integration test project added to the solution.

v2.1.0 β€” 12-Way Matrix Validation & Index Fidelity

  • DatabaseType Enum β€” Replaced string-based DB type comparisons throughout the internal pipeline with a strongly-typed DatabaseType enum and ToEnum() / ToProviderKey() extension methods.
  • --preserve-names Flag β€” New CLI flag (and .PreserveNames() fluent method) to retain original identifiers instead of applying target DB naming conventions (snake_case / PascalCase / UPPERCASE).
  • Oracle CHECK Constraint Fix β€” Oracle stores CHECK expressions with "COLUMN" double-quoted identifiers. When migrating to Postgres these caused a zero-length delimited identifier error. Fix gates on source DB detection and strips Oracle double-quotes before identifier conversion.
  • SYSTIMESTAMP Detection β€” Added SYSTIMESTAMP to Oracle indicators in DetectSourceDatabase so Oracle DEFAULT expressions are correctly identified and converted (previously fell through to SQL Server handling).
  • Postgres Index Fidelity β€” PostgresSchemaReader now excludes indexes that back a pg_constraint record, preventing unique-constraint backing indexes from being double-counted as standalone indexes during round-trip migrations.
  • MySQL Index Fidelity β€” MySqlSchemaReader now excludes FK auto-backing indexes (MySQL silently creates an index for every foreign key column). Previously inflated index counts by ~39 when migrating from MySQL.
  • Full 12-Path Matrix Validated β€” All 12 sourceβ†’target migration combinations verified against the Microsoft WideWorldImporters dataset (993,095 rows across 45 tables, 5 schemas) with row counts confirmed in sync across SQL Server, PostgreSQL, MySQL, and Oracle.

v2.0.3 β€” CLI Stability Patch

  • Fixed Dry Run Output β€” Resolved an issue where the --dry-run-output flag failed to save the generated SQL script to disk.
  • Improved Boolean Consistency β€” Standardized tinyint to boolean mapping for PostgreSQL to ensure view compatibility.
  • Enhanced MySQL Discovery β€” Fixed schema/database resolution in MySqlSchemaReader.

v2.0.2 β€” Enterprise Resilience Update

  • Major Release β€” Full 12-path verification matrix complete with WWI dataset.
  • Robust FKs β€” Implemented ENABLE NOVALIDATE (Oracle), NOT VALID (Postgres), and WITH NOCHECK (SQL Server).
  • MySQL Driver Upgrade β€” Switched to MySqlConnector for superior Docker/SSL stability.
  • Infrastructure Automation β€” Added EnsureDatabaseExistsAsync for SQL Server and MySQL.
  • Dialect Expansion β€” Added support for BITAND, DECODE, and FROM_TZ translations.
  • API Enhancement β€” New WithMaxParallelTables(n) and WithSourceSchemaFilter fluent methods.
  • Performance β€” Implemented sql_log_bin=0 for MySQL to prevent "Disk Full" errors during large moves.
  • Bug Fixes β€” Fixed 15+ critical bugs in view routing, regex backreferences, and identifier quoting.

v1.0.51

  • Fixed SQL Server to SQL Server migration issues and cross-schema FK references.

License: MIT

Product Compatible and additional computed target framework versions.
.NET 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 was computed.  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.

NuGet packages (5)

Showing the top 5 NuGet packages that depend on SchemaForge.Abstractions:

Package Downloads
SchemaForge

Cross-database schema and data migration library for .NET

SchemaForge.Providers.MySql

MySQL provider for SchemaForge database migration

SchemaForge.Providers.Postgres

PostgreSQL provider for SchemaForge database migration

SchemaForge.Providers.SqlServer

SQL Server provider for SchemaForge database migration

SchemaForge.Providers.Oracle

Oracle provider for SchemaForge database migration

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.1.1 172 4/11/2026
2.0.2 169 3/9/2026
2.0.1 150 3/7/2026