Add portable column-plus-primary-key and unique-constraint removal APIs - #197
Merged
Merged
Conversation
Consumers should not manipulate SQLite table-rebuild metadata to introduce an identity column or remove a legacy unnamed unique constraint. Add an explicit column-plus-primary-key overload, using one SQLite rebuild and one MySQL/MariaDB ALTER statement, with the normal DDL semantics elsewhere. Add metadata-based unique removal that requires an exact unambiguous match and preserves unrelated constraints. Regression coverage exercises both SQLite drivers, populated data, caller-owned definitions, downgrade, composite key order, failed backfill rollback, existing-key rejection, named and unnamed uniqueness, and SQL Server/MySQL SQL dispatch. Four cases failed before the SQLite implementation; all 400 Unit/SQLite tests now pass. Document the new APIs and provider transaction limitations.
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.
KCC migration 241 currently has to reconstruct an SQLite table itself to add an identity column and its primary key together. Migration 281 also reconstructs a table just to remove a legacy unnamed unique constraint. These operations belong in the provider API.
AddColumn(table, column, primaryKey). SQLite performs one transactional rebuild; MySQL/MariaDB use one ALTER statement so AUTO_INCREMENT is indexed immediately. Other providers dispatch through their existing column/key operations with their existing DDL transaction semantics.RemoveUniqueConstraint(table, definition), matching the metadata name and ordered columns. SQLite can remove an unnamed unique constraint without removing unrelated uniqueness or checks. Missing/ambiguous selections fail before changes.Validation: 1,167 tests passed in the full Unit/SQLite selection (including uncategorized unit tests), including 18 new cases covering both SQLite drivers, populated data, generated IDs, portable downgrade, composite key order, rollback after failed backfill, existing-key rejection, targeted unique removal, and MySQL/SQL Server dispatch. Four cases failed before the SQLite implementations. Release package build passed. KCC validation with the package: the full core solution and all four standalone tool solutions build; 42 database-layer tests pass with 2 existing skips, including SQLite/SQL Server/Oracle migration chains and the upgrade/downgrade and named/unnamed uniqueness regressions. KCC uses the two APIs to remove three consumer-side reconstruction blocks. Database configuration is unchanged.
Final KCC unit selection: 763 passed, 3 existing skips. Consumer changes and the tested package were committed as 7561dfbb968 and pushed to feature/jochen/newMigrator. The complete integration matrix was not rerun; the database-layer suite is the targeted integration validation.