[PXT-477] Migration for existing PK tables (Agent Team approach) - #6
Open
Chrisclone wants to merge 2 commits into
Open
[PXT-477] Migration for existing PK tables (Agent Team approach)#6Chrisclone wants to merge 2 commits into
Chrisclone wants to merge 2 commits into
Conversation
…bles Tables created with primary_key columns before PrimaryIndexMd was added have is_pk flags on columns but no PrimaryIndexMd and no physical unique index. This converter: - For tables with is_pk columns but no primary_index_md: attempts to CREATE UNIQUE INDEX with SAVEPOINT isolation - If succeeds: persists PrimaryIndexMd, logs success - If fails (duplicate rows): strips is_pk from all columns, sets primary_index_md=None, logs warning - Views are skipped; idempotent (safe to re-run) Includes integration tests verifying: - Happy path (index created, PK enforcement works) - Failure path (duplicates → PK stripped, rows preserved) - Composite PK with string columns (left() truncation) - Multi-table migration (one succeeds, one fails independently) - Idempotent re-run - No-PK tables unaffected Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ine single-use helper Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
PK Migration — Agent Team Approach
Apples-to-apples comparison with PR #5 (solo agent). Same task, same starting point, built by a 3-agent team (Coder → Tester → Red Team) using Claude Code Agent Teams.
Converter Design
table_modifier— notable_md_updater(avoids the metadata persistence bug that broke the solo v1)copy.deepcopy+ explicitconn.execute(sql.update)for both success and failure pathspg_tablesguard: skips if store table doesn't existpg_indexesidempotency: if index already exists, just syncs metadataTests (362 lines)
_simulate_pre_migration(),_get_table_md(),_index_exists()Comparison with PR #5 (solo agent v2)
Generated by OpenClaw Agent Team (Coder + Tester + Red Team)