diff --git a/hermes_state_search.py b/hermes_state_search.py index 3cd3427862..5986a4f840 100644 --- a/hermes_state_search.py +++ b/hermes_state_search.py @@ -532,9 +532,11 @@ class SessionSearchMixin: "AND (name LIKE 'messages_fts_%' ESCAPE '\\' " "OR name LIKE 'messages_fts_trigram_%' ESCAPE '\\') " # messages_fts_cjk* is an independent v23+ index, not part of the - # demoted legacy layout: renaming it (or its shadow tables) breaks - # the vtable constructor chain (#103647). - "AND name NOT LIKE 'messages_fts_cjk%'" + # demoted legacy layout: fts5's xRename renames the entire shadow + # family in one step, so sweeping the cjk vtable here aborts the + # loop on the next cjk shadow entry and drags _config — needed by + # the vtable constructor — into the trash family (#103647). + "AND name NOT LIKE 'messages\\_fts\\_cjk%' ESCAPE '\\'" ).fetchall(): conn.execute(f"ALTER TABLE {row[0]} RENAME TO fts_v22_trash_{row[0]}") # Claim the backfill BEFORE the empty v23 tables exist so a crash before