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

11 lines
418 B
SQL

CREATE TABLE IF NOT EXISTS invites (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
community_id uuid NOT NULL REFERENCES communities (id) ON DELETE CASCADE,
created_by uuid REFERENCES users (id),
code text UNIQUE NOT NULL,
max_uses int,
uses int DEFAULT 0,
expires_at timestamptz,
created_at timestamptz DEFAULT now()
);