Summary
The tool is fully coupled to PostgreSQL through Npgsql and pg_dump/pg_restore. There is no abstraction layer for the database provider, migration backend, or SQL dialect. Supporting additional engines requires a full refactor.
Current Limitation
- All connections use
new NpgsqlConnection(...) directly in Sanitizer.cs and SchemaValidator.cs
- Migration is hardcoded to spawning
pg_dump and pg_restore subprocesses
- Schema introspection queries are PostgreSQL-specific (
information_schema, Npgsql types)
- Sanitization SQL uses PostgreSQL-specific functions (e.g.,
encode(sha256(...), 'hex'))
Proposed Approach
Introduce three interfaces:
interface IDbProvider // CreateConnection(), GetColumnInfoQuery(), etc.
interface IMigrationBackend // DumpAsync(), RestoreAsync()
interface ISqlDialect // HashExpression(), ConcatExpression(), etc.
Register the correct implementation via DI based on a engine: postgres | mysql | sqlserver config field.
Acceptance Criteria
Summary
The tool is fully coupled to PostgreSQL through Npgsql and
pg_dump/pg_restore. There is no abstraction layer for the database provider, migration backend, or SQL dialect. Supporting additional engines requires a full refactor.Current Limitation
new NpgsqlConnection(...)directly inSanitizer.csandSchemaValidator.cspg_dumpandpg_restoresubprocessesinformation_schema, Npgsql types)encode(sha256(...), 'hex'))Proposed Approach
Introduce three interfaces:
Register the correct implementation via DI based on a
engine: postgres | mysql | sqlserverconfig field.Acceptance Criteria