tia/drizzle/0004_circle_invite_email.sql
Mannu c24392f0a1 feat: email-based circle invites with in-app notifications
- Admin invites by entering email instead of copying a link
- If email matches existing Tia user → creates pending invite visible
  on their Circles page with Accept/Decline buttons
- If email is not registered → sends Resend email with signup link
  that lands them directly in the circle after account creation
- DB migration adds invited_email + invited_family_id to circle_invites
- New GET /api/circles/invites endpoint for pending invite banners
- Remove clipboard-copy approach entirely

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-24 02:05:10 +05:30

9 lines
552 B
SQL

-- Add email-based invite columns to circle_invites.
-- invited_email: the address that was invited
-- invited_family_id: set when the email matches an existing family (for in-app notification)
ALTER TABLE circle_invites ADD COLUMN IF NOT EXISTS invited_email text;
--> statement-breakpoint
ALTER TABLE circle_invites ADD COLUMN IF NOT EXISTS invited_family_id uuid REFERENCES families(id);
--> statement-breakpoint
CREATE INDEX IF NOT EXISTS circle_invites_invited_family_idx ON circle_invites(invited_family_id) WHERE invited_family_id IS NOT NULL;