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

10 lines
420 B
SQL

CREATE TABLE IF NOT EXISTS community_members (
community_id uuid NOT NULL REFERENCES communities (id) ON DELETE CASCADE,
user_id uuid NOT NULL REFERENCES users (id) ON DELETE CASCADE,
role text NOT NULL CHECK (role IN ('owner', 'admin', 'member')),
nickname text,
avatar_url text,
joined_at timestamptz DEFAULT now(),
PRIMARY KEY (community_id, user_id)
);