-- 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;
