Skip to main content

max / makenotwork

824 B · 21 lines History Blame Raw
1 -- Invite codes for controlled alpha growth.
2 -- Creators generate codes, new users redeem them to skip the pitch requirement.
3
4 CREATE TABLE invite_codes (
5 id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
6 code VARCHAR(12) NOT NULL UNIQUE,
7 creator_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
8 redeemed_by_id UUID REFERENCES users(id) ON DELETE SET NULL,
9 redeemed_at TIMESTAMPTZ,
10 created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
11 );
12
13 CREATE INDEX idx_invite_codes_code ON invite_codes(code);
14 CREATE INDEX idx_invite_codes_creator ON invite_codes(creator_id);
15
16 -- Invited users skip the pitch
17 ALTER TABLE creator_waitlist ALTER COLUMN pitch DROP NOT NULL;
18
19 -- Track who invited each applicant
20 ALTER TABLE creator_waitlist ADD COLUMN invited_by_user_id UUID REFERENCES users(id) ON DELETE SET NULL;
21