-- Synastry social: profile geo + invite tokens ALTER TABLE profiles ADD COLUMN IF NOT EXISTS geo_lat double precision NULL; ALTER TABLE profiles ADD COLUMN IF NOT EXISTS geo_lng double precision NULL; ALTER TABLE profiles ADD COLUMN IF NOT EXISTS geo_visible boolean NOT NULL DEFAULT false; CREATE TABLE IF NOT EXISTS synastry_invites ( id uuid PRIMARY KEY DEFAULT gen_random_uuid(), token varchar(64) NOT NULL UNIQUE, host_user_id uuid NOT NULL REFERENCES users(id), host_profile_id uuid NOT NULL REFERENCES profiles(id), expires_at timestamptz NOT NULL, guest_user_id uuid NULL REFERENCES users(id), guest_profile_id uuid NULL REFERENCES profiles(id), report_id uuid NULL REFERENCES growth_reports(id), created_at timestamptz NOT NULL DEFAULT now(), updated_at timestamptz NOT NULL DEFAULT now(), deleted_at timestamptz NULL ); CREATE INDEX IF NOT EXISTS idx_synastry_invites_token ON synastry_invites(token); CREATE INDEX IF NOT EXISTS idx_synastry_invites_host ON synastry_invites(host_user_id); CREATE INDEX IF NOT EXISTS idx_profiles_geo_visible ON profiles(geo_visible) WHERE geo_visible = true AND deleted_at IS NULL;