Skip to content

Multi-engine support (MySQL, SQL Server, etc.) #1

Description

@cl8dep

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

  • PostgreSQL continues to work as before
  • At least one additional engine (e.g., MySQL) can be configured
  • All engine-specific SQL is isolated behind the dialect interface
  • Tests cover the abstraction layer

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions