Repository navigation
fix(mental-models): widen the columns that reference mental_models.id (#5788) - #5793
Merged
Merged
Conversation
…#5788) mental_model_history.mental_model_id and knowledge_pages.mental_model_id were VARCHAR(64) on PostgreSQL (knowledge_pages VARCHAR2(64) on Oracle) while mental_models.id is TEXT / VARCHAR2(256). A mental model with an id over 64 chars could be created but every refresh failed on the history insert. - new migration f2a9c4e7b1d3 widens both columns (PG: TEXT, Oracle: knowledge_pages to VARCHAR2(256)) - fix the CREATE TABLE DDL in a7b8c9d0e1f2 and a9b8c7d6e5f4 for fresh installs - regression test narrows the columns, runs the repair, writes an 87-char id Closes #5788
This was referenced Oct 20, 2026
Merged
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.
Closes #5788
Problem:
mental_models.idisTEXTon PostgreSQL, butmental_model_history.mental_model_idandknowledge_pages.mental_model_idwere stillVARCHAR(64). A mental model with an id over 64 chars could be created, but every refresh failed on the history insert (value too long for type character varying(64)), and the failure record failed the same way. Oracle had the same gap onknowledge_pages.mental_model_id(VARCHAR2(64)vsVARCHAR2(256)).Fix:
f2a9c4e7b1d3widens both columns on PG toTEXT(binary-coercible, no rewrite) andknowledge_pages.mental_model_idon Oracle toVARCHAR2(256). Downgrade is a no-op (narrowing could truncate real ids).CREATE TABLEDDL ina7b8c9d0e1f2anda9b8c7d6e5f4now uses the wide type, so fresh installs get it directly.Test:
tests/test_migration_mental_model_id_text.pynarrows both columns back toVARCHAR(64), runs the repair, and writes a mental model, history row and knowledge page with an 87-char id.