CREATE TABLE IF NOT EXISTS team_invitations ( id UUID NOT NULL PRIMARY KEY, team_id UUID NOT NULL REFERENCES teams(id) ON DELETE CASCADE, email TEXT NOT NULL, created_by UUID NOT NULL REFERENCES users(id) ON DELETE RESTRICT, verification_code TEXT NOT NULL, UNIQUE (team_id, email) ); CREATE INDEX ON team_invitations(team_id); CREATE INDEX ON team_invitations(verification_code);