fix: use text type for channel_id to match tablos.id column type

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Arthur Belleville 2026-04-11 15:41:52 +02:00
parent 0e8788f32b
commit f182fff68e

View file

@ -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)
);