-- ==================================================================== -- 0064_push_expo_token_index_fix — Expo-Push-Registrierung reparieren -- ==================================================================== -- Migration 0062 legte den Unique-Index auf expo_push_token als PARTIELLEN -- Index an (`where expo_push_token is not null`). Postgres kann einen -- partiellen Index bei `ON CONFLICT (spalte)` aber nur dann per Inferenz -- treffen, wenn das Statement dasselbe WHERE-Prädikat mitschickt — -- supabase-js/PostgREST schickt nur den Spaltennamen. Folge: der Upsert in -- lib/push.ts (saveExpoPushSubscription, onConflict "expo_push_token") lief -- in Fehler 42P10 „there is no unique or exclusion constraint matching the -- ON CONFLICT specification". Die native App bekam trotzdem ok:true (der -- Fehler wurde nicht geprüft), sodass der Schalter an blieb, aber nie ein -- Abo gespeichert wurde. -- -- Das Prädikat war überflüssig: NULL-Werte kollidieren in Postgres nie mit -- anderen NULLs, die Web-Zeilen ohne Token bleiben also auch mit einem -- normalen Unique-Index erlaubt. drop index if exists public.push_subscriptions_expo_token_key; create unique index if not exists push_subscriptions_expo_token_key on public.push_subscriptions (expo_push_token);