fix(db): add missing chat_messages.workflow column

↗ view on GitHub · JJ · 2026-07-16 · cfdcda6d

User messages are persisted with a `workflow` field
(backend/src/routes/chat.ts, projectChat.ts) and it is read back when
rendering chat history (ChatView -> UserMessage) to show which workflow a
message was sent under. But the column is never created by schema.sql or any
migration, so every user-message insert fails with PostgREST PGRST204
("Could not find the 'workflow' column of 'chat_messages'") and is dropped
silently (the insert result is not checked). The assistant insert has no
workflow column, so it succeeds - the net effect on a self-hosted install is
that reloading a thread shows the assistant reply but not the user's prompt.

Add the `workflow jsonb` column to schema.sql (fresh installs) and a
migration (existing installs), mirroring the adjacent content/files jsonb
columns.
Repository open-legal-products/mike
Author JJ <mooves@hotmail.com>
Authored
Committed
Parents e32daad5
Stats 2 files changed , +13
Part of Strengthen workflow data and project loading

Capture this commit into my fork

Download a Markdown prompt that tells Claude how to port this exact commit into your working tree. Run it via claude -p < capture-commit-cfdcda6d.md from inside the repo you want the change in.

⬇ Download capture-commit-cfdcda6d.md