Revert "chore(db): remove deprecated entity schema from memory_links" (#3177) - #3244
Merged
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.
Reverts #3177 (squash commit 5f8a030).
Why
Migration
c1e7a9d3f5b2collapsesidx_memory_links_unique— which means rebuilding the unique index onmemory_links. On large established banks that table (and index) is huge, and even withCONCURRENTLY/ONLINEthe rebuild is a long, expensive operation we don't want to impose for what was a pure schema cleanup with no functional benefit.#3177 was never shipped in a core release (latest is v0.8.6, cut 2026-07-29), so reverting now means released environments never run it.
What this PR does
git revertof the squash commit: restores thememory_linksentity schema plumbing (MemoryLink.entity_id, write-path code, tests) and deletes migrationc1e7a9d3f5b2and its migration test.f2a6d8c4b1e9(drop stale global vector index) chained off the deleted revision; it is re-parented ontoe4a7c1b9d2f6(dropaccess_count). Chain now resolves to the single headb3e8d1c6f4a9(verified by walking all 94 revisions).Upgrade path from v0.8.6 is now
… → e4a7c1b9d2f6 → f2a6d8c4b1e9 → b3e8d1c6f4a9— the entity-schema drop is simply gone from the tree, so upgraders never execute it.Caveat for environments tracking
mainAny environment that started the API between #3177's merge (2026-08-04) and this revert has already applied
c1e7a9d3f5b2(migrations run on startup):alembic_versionhas since advanced past it, migrations still resolve, but the schema is missingmemory_links.entity_idwhile the reverted code writes that column — it needs a manual re-add of the entity schema (or a DB reset for dev envs).alembic_versionis exactlyc1e7a9d3f5b2, Alembic will fail with "Can't locate revision" until the version row is stamped toe4a7c1b9d2f6.This only affects main-trackers from the last 3 days; no released environment is impacted.
Testing
tests/test_migration_shape.py+tests/test_link_utils.pypass (215 passed)../scripts/hooks/lint.shclean.