An admin can pick a package when inviting: each invitee gets a promo code (in the e-mail and its preview, kept on resend), redeemed by itself at sign up; revoking the invitation withdraws it, and the list shows the package. Redeeming a promo code now fills the units up to the package's amounts: used units come back, more than that stays. A code that would add nothing stays open, with a message saying so; the answer tells what was added. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
4 lines
250 B
SQL
4 lines
250 B
SQL
-- An invitation can come with a package: a promo code made with it, sent in
|
|
-- the e-mail and redeemed by itself when the invitee signs up.
|
|
ALTER TABLE promo_codes ADD COLUMN invitation_id uuid UNIQUE REFERENCES invitations (id) ON DELETE SET NULL;
|