Skip to content

Fix migration 103: users table uses workos_user_id as PK#501

Merged
bokelley merged 1 commit into
mainfrom
bokelley/addie-dm-fix
Jan 3, 2026
Merged

Fix migration 103: users table uses workos_user_id as PK#501
bokelley merged 1 commit into
mainfrom
bokelley/addie-dm-fix

Conversation

@bokelley

@bokelley bokelley commented Jan 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Fixed foreign key references in migration 103 (sensitive_topics.sql)
  • The users table uses workos_user_id VARCHAR(255) as its primary key, not id INTEGER

Problem

Migration 103 was failing with:

error: column "id" referenced in foreign key constraint does not exist

The flagged_conversations and known_media_contacts tables were trying to reference users(id) which doesn't exist.

Fix

Changed:

reviewed_by INTEGER REFERENCES users(id)
added_by INTEGER REFERENCES users(id)

To:

reviewed_by VARCHAR(255) REFERENCES users(workos_user_id)
added_by VARCHAR(255) REFERENCES users(workos_user_id)

Test plan

  • All tests pass
  • Verify migration runs successfully on Fly.io

🤖 Generated with Claude Code

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 <noreply@anthropic.com>
@bokelley
bokelley merged commit 5d0273e into main Jan 3, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant