Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
revert v248 edit: published migrations are never changed; it runs once per upgrade
garrytanb0b40942a25e
diff --git a/src/core/schema-migrations/v248-segmented-page-storage.ts b/src/core/schema-migrations/v248-segmented-page-storage.tsindex c02f4349ae..381d3604a3 100644--- a/src/core/schema-migrations/v248-segmented-page-storage.ts+++ b/src/core/schema-migrations/v248-segmented-page-storage.ts@@ -1,7 +1,7 @@import type { Migration } from './types.ts';import { PAGE_BODY_SCHEMA_SQL, PAGE_GENERATION_BUMP_FN_SQL } from '../page-body/schema.ts';import { PAGE_SEARCH_VECTOR_TRIGGER_SQL } from '../page-state/projection-schema.ts';-import { analyzeYieldingToVacuum, buildIndexOnline, migrationNotice } from './helpers.ts';+import { buildIndexOnline, migrationNotice } from './helpers.ts';// Applied by src/core/migrate.ts on the next initSchema(); see docs/ENGINES.md// ("Canonical schema sources") for when schema.sql or a TS fragment also changes.@@ -109,13 +109,8 @@ export const v248: Migration = {await buildIndexOnline(engine, 248, CONTENT_CHUNKS_OCCURRENCE_INDEX, { notice: migrationNotice });// Search's visibility predicate reads the generation columns; without their statistics Postgres prices it at 0.5%// and vector search sorts every candidate instead of walking its HNSW index (projection-statistics.ts).- // #7083: an ANALYZE that waited on a running autovacuum cancelled it; a deferred one is left to the search guard and doctor.if (engine.kind === 'postgres') {- for (const [table, columns] of [['pages', 'body_generation'], ['content_chunks', 'body_generation, retired_generation']] as const) {- if (await analyzeYieldingToVacuum(engine, table, columns)) continue;- migrationNotice(` ANALYZE ${table}(${columns}) deferred: another session (a vacuum, an ANALYZE or an index build) holds ${table}. `- + 'The search statistics refresh and doctor planner_stats_stale pick it up; no migration step waits on it.');- }+ await engine.runMigration(248, 'ANALYZE pages(body_generation); ANALYZE content_chunks(body_generation, retired_generation);');}},};diff --git a/test/fixtures/goldens/migrations/records.json b/test/fixtures/goldens/migrations/records.jsonindex 1cab05d215..ebaeb44ccf 100644--- a/test/fixtures/goldens/migrations/records.json+++ b/test/fixtures/goldens/migrations/records.json@@ -3851,7 +3851,7 @@"quietMigrationNotices","tableRows"],- "sha256": "dfc8436e6cbe379e2c8a74d064eb4e8d7e875f744abbce75b6022b8e966f577c"+ "sha256": "f534fe8c1c2a21a072644ff97155d6298e87245cf293fbf25b94c0713f6f4a66"},"idempotent": true,"name": "segmented_page_storage",