feat(db): add SQLite migration SQL generation - #2
Open
Fhatu12 wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
SQLite is accepted by the migration CLI, but
makemigrations --dialect sqlitehad no SQL generator behind it.Implementation
ADD COLUMNforms before migration files are written.makemigrations --dialect sqlitethrough the new generator while preserving MySQL as the default.Executable proof
Generated SQLite migrations are executed against temporary in-memory SQLite databases in
vix_db_sql_generator_tests; the tests assert table/column/index metadata, unique-index enforcement, drop behavior, and down-migration recovery for reversible operations.Validation
/tmp/vix-cmake-venv; no sudo/global install./tmp/vix-sqlite-dev.1I4RDT/extract/usrfor SQLite, nlohmann_json, fmt, and spdlog.cmake -S . -B /tmp/vix-db-pr2-build.Z1AZof -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DVIX_DB_BUILD_TESTS=ON -DVIX_DB_BUILD_EXAMPLES=OFF -DVIX_DB_BUILD_TOOLS=ON -DVIX_DB_USE_MYSQL=OFF -DVIX_DB_USE_SQLITE=ON -DVIX_DB_REQUIRE_SQLITE=ON ...cmake --build /tmp/vix-db-pr2-build.Z1AZof --parallelpassed; builtlibvix_db.a,vix_db_sql_generator_tests, andvix_db_migrator.ctest --test-dir /tmp/vix-db-pr2-build.Z1AZof --output-on-failurepassed 10/10, includingvix_db_sql_generator_tests./tmp/vix-db-pr2-build.Z1AZof/vix_db_sql_generator_tests->vix_db_sql_generator_tests passed.cmake --install /tmp/vix-db-pr2-build.Z1AZof --prefix /tmp/vix-db-pr2-install.E5tKsSpassed. Installedinclude/vix/db/mig/sql/MySqlGenerator.hpp,include/vix/db/mig/sql/SQLiteGenerator.hpp,lib/libvix_db.a, andlibexec/vix/vix_db_migrator.SQLiteGenerator.hppandlibvix_db.a.cppcheckandclang-tidyare not installed locally; no new tooling added for this pass.Configure also confirms SQLite requested/detected ON and MySQL requested/detected OFF. The only configure warning is an upstream CMake author warning that
SQLite::SQLite3is deprecated in favor ofSQLite3::SQLite3.Compatibility
Existing MySQL generation is covered by a regression golden test inside
vix_db_sql_generator_tests; MySQL remains the default dialect and no live MySQL server is required.AI disclosure
OpenAI Codex assisted with codebase analysis, implementation, and validation. I reviewed the changes and take responsibility for the contribution.
Closes vixcpp/vix#460
Notes
This is module-first for
vixcpp/db; the umbrella submodule pointer should be updated after this module commit is available upstream.