From d367f00077feb57a0caee58e5823f8668a812fa3 Mon Sep 17 00:00:00 2001 From: Jarvis Date: Mon, 30 Mar 2026 21:09:34 -0500 Subject: [PATCH 1/2] fix(db): add missing 0001_cynical_ultimatum to Drizzle migration journal The migration file 0001_cynical_ultimatum.sql existed on disk but was not registered in the Drizzle journal (_journal.json). This caused fresh-database migrations (CI) to skip creating tables (agent_logs, insights, preferences, skills, summarization_jobs), then 0002_nebulous_mimic.sql would fail trying to ALTER the non-existent preferences table. Fix: insert cynical_ultimatum at idx 1 in the journal and shift all subsequent entries (idx 2-7). Verified: pnpm test passes (347 tests, 35 tasks). --- .../scratchpads/fix-ci-migrations-20260330.md | 20 +++++++++++++++++++ packages/db/drizzle/meta/_journal.json | 19 ++++++++++++------ 2 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 docs/scratchpads/fix-ci-migrations-20260330.md diff --git a/docs/scratchpads/fix-ci-migrations-20260330.md b/docs/scratchpads/fix-ci-migrations-20260330.md new file mode 100644 index 0000000..8bc8b90 --- /dev/null +++ b/docs/scratchpads/fix-ci-migrations-20260330.md @@ -0,0 +1,20 @@ +# Scratchpad — fix-ci-migrations-20260330 + +## Objective + +- Fix Drizzle migration journal ordering so fresh Postgres instances apply all schema migrations in CI. + +## Plan + +- Inspect migration SQL, journal, and snapshot chain. +- Patch metadata consistently. +- Run full test suite. +- Record result and risks. + +## Progress + +- Inspected migration files and confirmed 0001_cynical_ultimatum.sql is missing from journal while 0002 depends on it. +- Patched `packages/db/drizzle/meta/_journal.json` to insert `0001_cynical_ultimatum` at idx 1 and shift later entries to idx 2-7. +- Verified snapshot content is already semantically aligned with the fixed ordering: the missing tables exist in `0001_snapshot.json`, and `mutable` appears in later snapshots. +- Installed workspace dependencies in this worktree to make the requested test command runnable. +- Ran `pnpm test` successfully; gateway reported `347 passed (347)` and Turbo finished with `35 successful, 35 total`. diff --git a/packages/db/drizzle/meta/_journal.json b/packages/db/drizzle/meta/_journal.json index f452456..a51c56b 100644 --- a/packages/db/drizzle/meta/_journal.json +++ b/packages/db/drizzle/meta/_journal.json @@ -12,44 +12,51 @@ { "idx": 1, "version": "7", + "when": 1773602195608, + "tag": "0001_cynical_ultimatum", + "breakpoints": true + }, + { + "idx": 2, + "version": "7", "when": 1773602195609, "tag": "0001_magical_rattler", "breakpoints": true }, { - "idx": 2, + "idx": 3, "version": "7", "when": 1773625181629, "tag": "0002_nebulous_mimic", "breakpoints": true }, { - "idx": 3, + "idx": 4, "version": "7", "when": 1773887085247, "tag": "0003_p8003_perf_indexes", "breakpoints": true }, { - "idx": 4, + "idx": 5, "version": "7", "when": 1774224004898, "tag": "0004_bumpy_miracleman", "breakpoints": true }, { - "idx": 5, + "idx": 6, "version": "7", "when": 1774225763410, "tag": "0005_minor_champions", "breakpoints": true }, { - "idx": 6, + "idx": 7, "version": "7", "when": 1774227064500, "tag": "0006_swift_shen", "breakpoints": true } ] -} \ No newline at end of file +} -- 2.49.1 From 9b72f0ea14dde2738976a5bcf97a662ffc44246a Mon Sep 17 00:00:00 2001 From: Jarvis Date: Mon, 30 Mar 2026 21:14:44 -0500 Subject: [PATCH 2/2] fix(db): add CREATE EXTENSION vector before first migration using pgvector The insights table uses vector(1536) but no migration enables the pgvector extension. CI postgres (pgvector/pgvector:pg17) has the extension available but it must be explicitly created before use. Adds CREATE EXTENSION IF NOT EXISTS vector at the top of 0001_cynical_ultimatum.sql (the first migration referencing vector type). --- packages/db/drizzle/0001_cynical_ultimatum.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/db/drizzle/0001_cynical_ultimatum.sql b/packages/db/drizzle/0001_cynical_ultimatum.sql index 8eea8d8..290c8e3 100644 --- a/packages/db/drizzle/0001_cynical_ultimatum.sql +++ b/packages/db/drizzle/0001_cynical_ultimatum.sql @@ -1,3 +1,4 @@ +CREATE EXTENSION IF NOT EXISTS vector;--> statement-breakpoint CREATE TABLE "agent_logs" ( "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, "session_id" text NOT NULL, -- 2.49.1