From 4556b0c40e7e7127a113f078d02a797034d80d03 Mon Sep 17 00:00:00 2001 From: Brian O'Kelley Date: Sat, 3 Jan 2026 13:59:20 -0500 Subject: [PATCH] Fix migration 103: users table uses workos_user_id as PK, not id MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The users table has workos_user_id VARCHAR(255) as its primary key, not an integer id column. Fixed the foreign key references in flagged_conversations and known_media_contacts tables. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- server/src/db/migrations/103_sensitive_topics.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/db/migrations/103_sensitive_topics.sql b/server/src/db/migrations/103_sensitive_topics.sql index 73d66f7416..defccf79c0 100644 --- a/server/src/db/migrations/103_sensitive_topics.sql +++ b/server/src/db/migrations/103_sensitive_topics.sql @@ -211,7 +211,7 @@ CREATE TABLE IF NOT EXISTS flagged_conversations ( severity VARCHAR(20), response_given TEXT, was_deflected BOOLEAN DEFAULT FALSE, - reviewed_by INTEGER REFERENCES users(id), + reviewed_by VARCHAR(255) REFERENCES users(workos_user_id), reviewed_at TIMESTAMP WITH TIME ZONE, review_notes TEXT, created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() @@ -242,7 +242,7 @@ CREATE TABLE IF NOT EXISTS known_media_contacts ( handling_level VARCHAR(20) DEFAULT 'standard' CHECK (handling_level IN ('standard', 'careful', 'executive_only')), is_active BOOLEAN DEFAULT TRUE, - added_by INTEGER REFERENCES users(id), + added_by VARCHAR(255) REFERENCES users(workos_user_id), created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(), updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW() );