feat: added invite table

This commit is contained in:
2026-08-29 16:59:20 +02:00
parent ac00c791af
commit ac527e1928
4 changed files with 26 additions and 13 deletions
@@ -0,0 +1,12 @@
CREATE TABLE IF NOT EXISTS invites (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
inviter_user_id UUID REFERENCES users(id) ON DELETE SET NULL,
invitee_user_id UUID REFERENCES users(id) ON DELETE SET NULL,
code VARCHAR(128) NOT NULL,
consumed_at TIMESTAMPTZ,
expires_at TIMESTAMPTZ NOT NULL,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE UNIQUE INDEX idx_invites_code ON invites (code);
CREATE INDEX idx_invites_inviter_user_id ON invites (inviter_user_id);