From f182fff68e2bb7f6686728a40779ed924157cca3 Mon Sep 17 00:00:00 2001 From: Arthur Belleville Date: Sat, 11 Apr 2026 15:41:52 +0200 Subject: [PATCH] fix: use text type for channel_id to match tablos.id column type Co-Authored-By: Claude Opus 4.6 (1M context) --- supabase/migrations/20260411_create_chat_tables.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/supabase/migrations/20260411_create_chat_tables.sql b/supabase/migrations/20260411_create_chat_tables.sql index 63eee12..cb092ce 100644 --- a/supabase/migrations/20260411_create_chat_tables.sql +++ b/supabase/migrations/20260411_create_chat_tables.sql @@ -3,7 +3,7 @@ -- Messages table CREATE TABLE IF NOT EXISTS messages ( id uuid PRIMARY KEY DEFAULT gen_random_uuid(), - channel_id uuid NOT NULL REFERENCES tablos(id) ON DELETE CASCADE, + channel_id text NOT NULL REFERENCES tablos(id) ON DELETE CASCADE, user_id uuid NOT NULL REFERENCES auth.users(id), text text NOT NULL, created_at timestamptz NOT NULL DEFAULT now(), @@ -16,7 +16,7 @@ CREATE INDEX IF NOT EXISTS idx_messages_channel_created ON messages(channel_id, -- Read state table CREATE TABLE IF NOT EXISTS channel_read_state ( user_id uuid NOT NULL REFERENCES auth.users(id), - channel_id uuid NOT NULL REFERENCES tablos(id) ON DELETE CASCADE, + channel_id text NOT NULL REFERENCES tablos(id) ON DELETE CASCADE, last_read_at timestamptz NOT NULL DEFAULT now(), PRIMARY KEY (user_id, channel_id) );