Skip to content

feat(db): add SQLite migration SQL generation #460

Description

@GaspardKirira

Summary

Add SQLite SQL generation for schema migration operations.

The migration CLI already accepts --dialect sqlite, but migration generation currently supports only MySQL.

Current behavior

The schema diff engine produces portable migration operations.

Only MySqlGenerator converts those operations into SQL.

Requesting SQLite migration generation results in an error.

Expected behavior

The DB module must generate valid SQLite up and down migration scripts for all operations currently supported by the schema diff engine.

SQLite limitations must be handled explicitly.

Scope

  • Add a SQLite SQL generator.
  • Generate table creation SQL.
  • Generate table removal SQL.
  • Generate column addition SQL.
  • Handle column removal according to supported SQLite versions.
  • Generate normal and unique indexes.
  • Generate down migrations.
  • Quote SQLite identifiers safely.
  • Connect --dialect sqlite to the generator.
  • Add golden tests.
  • Preserve existing schema and migration APIs.

Suggested files

  • modules/db/include/vix/db/mig/sql/SQLiteGenerator.hpp
  • modules/db/src/mig/sql/SQLiteGenerator.cpp
  • modules/db/tools/migrator/MakeMigrations.cpp
  • modules/db/tests/sqlite_generator_test.cpp
  • modules/db/CMakeLists.txt

Acceptance criteria

  • --dialect sqlite generates migration files.
  • All currently portable schema types map to valid SQLite types.
  • Index creation and removal are supported.
  • Unsupported operations fail with clear diagnostics.
  • Generated up and down SQL is deterministic.
  • Generated migrations execute successfully against SQLite.
  • MySQL generation remains unchanged.
  • Existing public APIs remain compatible.

Non-goals

This issue does not include:

  • PostgreSQL generation;
  • full table-rebuild automation for every SQLite alteration;
  • ORM migrations;
  • database introspection.

Suggested labels

  • scope:db
  • type:feature
  • tests
  • help wanted
  • status:accepted

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is neededscope:dbDatabase driversstatus:acceptedApproved, plannedtestsTests, CI coverage and validationtype:featureNew functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions