Files
ajet-chat/api/resources/migrations/008-create-messages.up.sql
2026-02-17 17:30:45 -05:00

10 lines
427 B
SQL

CREATE TABLE IF NOT EXISTS messages (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
channel_id uuid NOT NULL REFERENCES channels (id) ON DELETE CASCADE,
user_id uuid REFERENCES users (id) ON DELETE SET NULL,
parent_id uuid REFERENCES messages (id) ON DELETE SET NULL,
body_md text NOT NULL,
created_at timestamptz DEFAULT now(),
edited_at timestamptz
);