SchemaForge.Abstractions
2.1.1
dotnet add package SchemaForge.Abstractions --version 2.1.1
NuGet\Install-Package SchemaForge.Abstractions -Version 2.1.1
<PackageReference Include="SchemaForge.Abstractions" Version="2.1.1" />
<PackageVersion Include="SchemaForge.Abstractions" Version="2.1.1" />
<PackageReference Include="SchemaForge.Abstractions" />
paket add SchemaForge.Abstractions --version 2.1.1
#r "nuget: SchemaForge.Abstractions, 2.1.1"
#:package SchemaForge.Abstractions@2.1.1
#addin nuget:?package=SchemaForge.Abstractions&version=2.1.1
#tool nuget:?package=SchemaForge.Abstractions&version=2.1.1
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), andWITH 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
MigrationBuilderServiceProvider Disposal βExecuteAsyncnow disposes theServiceProvider(and its connection pool) in afinallyblock. Previously, callingExecuteAsyncin a loop (e.g., once per schema) accumulated undisposed pools, causing connection exhaustion on large multi-schema migrations.- Batch
DataTableDisposal βBulkDataMigratordisposes each batchDataTableimmediately 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.GenerateAddForeignKeySqlwas applyingnamingConverter.Convert()to the FK name after prependingFK_, resulting inFK_FK_prefixes on round-trip migrations. The second convert call is removed; the name is final after prefix prepending. SqlServerDataReaderCOUNT(*) Timeout βGetRowCountAsyncnow setsCommandTimeout = 0(unlimited) to handle large tables whose cold-scanCOUNT(*)exceeds the 30-second default.docker-compose.test.ymlβ Switched SQL Server image fromazure-sql-edgetomssql/server:2022-latest; capped memory at 2 GB; updated healthcheck tomssql-tools18path.SchemaForge.IntegrationTestsβ New integration test project added to the solution.
v2.1.0 β 12-Way Matrix Validation & Index Fidelity
DatabaseTypeEnum β Replaced string-based DB type comparisons throughout the internal pipeline with a strongly-typedDatabaseTypeenum andToEnum()/ToProviderKey()extension methods.--preserve-namesFlag β 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 azero-length delimited identifiererror. Fix gates on source DB detection and strips Oracle double-quotes before identifier conversion. SYSTIMESTAMPDetection β AddedSYSTIMESTAMPto Oracle indicators inDetectSourceDatabaseso Oracle DEFAULT expressions are correctly identified and converted (previously fell through to SQL Server handling).- Postgres Index Fidelity β
PostgresSchemaReadernow excludes indexes that back apg_constraintrecord, preventing unique-constraint backing indexes from being double-counted as standalone indexes during round-trip migrations. - MySQL Index Fidelity β
MySqlSchemaReadernow 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-outputflag failed to save the generated SQL script to disk. - Improved Boolean Consistency β Standardized
tinyinttobooleanmapping 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), andWITH NOCHECK(SQL Server). - MySQL Driver Upgrade β Switched to
MySqlConnectorfor superior Docker/SSL stability. - Infrastructure Automation β Added
EnsureDatabaseExistsAsyncfor SQL Server and MySQL. - Dialect Expansion β Added support for
BITAND,DECODE, andFROM_TZtranslations. - API Enhancement β New
WithMaxParallelTables(n)andWithSourceSchemaFilterfluent methods. - Performance β Implemented
sql_log_bin=0for 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.
| Product | Versions 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. |
-
net9.0
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.