Skip to content

Add portable column-plus-primary-key and unique-constraint removal APIs - #197

Merged
jogibear9988 merged 3 commits into
masterfrom
codex/kcc-schema-api
Sep 24, 2026
Merged

jogibear9988 merged 3 commits into
masterfrom
codex/kcc-schema-api

Conversation

@jogibear9988

@jogibear9988 jogibear9988 commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

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.

  • Add 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.
  • Add 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.
  • Reject existing primary keys and invalid definitions; preserve caller-owned objects. Document provider transaction limits and custom-provider requirements.

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.

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.
Copilot AI lite review requested due to automatic review settings September 24, 2026 09:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings September 24, 2026 09:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@jogibear9988
jogibear9988 merged commit 474bc6b into master Sep 24, 2026
14 checks passed
@jogibear9988
jogibear9988 deleted the codex/kcc-schema-api branch September 24, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants