Nettoyage serveur et client : restes des anciennes notifications
- Migration 20261128120000 (appliquée) : azuu_notify (vide) supprimée et ses appels retirés de 6 fonctions ; table notifications réduite aux colonnes utiles (abonnements) - Fonction serveur send-push remplacée par une version qui refuse tout (410) : à supprimer depuis le tableau de bord Supabase - src/lib/push.ts (résiliation des anciens abonnements push) retiré Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YVo1qxKoBQCaMd7Ue8PGbe
This commit is contained in:
3 files changed
+53
-26
No files matched your search
@@ -0,0 +1,53 @@
|
||||
-- Bobinoo — ménage du 28 novembre 2026 : restes des anciennes notifications (push, commentaires,
|
||||
-- invitations de listes, épisodes). Idempotent. Seules les notifications d'abonnement subsistent.
|
||||
|
||||
-- 1) Les fonctions qui appelaient azuu_notify (qui ne faisait plus rien) ou nettoyaient des
|
||||
-- notifications d'invitation (plus jamais créées) : on retire seulement ces lignes, le reste est inchangé.
|
||||
do $$
|
||||
declare
|
||||
f text;
|
||||
def text;
|
||||
cleaned text;
|
||||
begin
|
||||
foreach f in array array[
|
||||
'public.add_review_comment(uuid,text,text)',
|
||||
'public.invite_to_shared_list(uuid,uuid)',
|
||||
'public.delete_shared_list(uuid)',
|
||||
'public.leave_shared_list(uuid)',
|
||||
'public.remove_shared_list_member(uuid,uuid)',
|
||||
'public.respond_shared_list_invite(uuid,boolean)'
|
||||
] loop
|
||||
if to_regprocedure(f) is null then continue; end if;
|
||||
def := pg_get_functiondef(to_regprocedure(f));
|
||||
cleaned := regexp_replace(def, '[ \t]*if n > 0 then\s*perform public\.azuu_notify\([^;]*\);\s*end if;[ \t]*\r?\n', '', 'g');
|
||||
cleaned := regexp_replace(cleaned, '[ \t]*--[^\n]*\r?\n[ \t]*perform public\.azuu_notify\([^;]*\);[ \t]*\r?\n', '', 'g');
|
||||
cleaned := regexp_replace(cleaned, '[ \t]*perform public\.azuu_notify\([^;]*\);[ \t]*\r?\n', '', 'g');
|
||||
cleaned := regexp_replace(cleaned, '[ \t]*delete from public\.notifications [^;]*shared_list_invite[^;]*;[ \t]*\r?\n', '', 'g');
|
||||
if cleaned <> def then execute cleaned; end if;
|
||||
end loop;
|
||||
end $$;
|
||||
|
||||
-- 2) Plus aucun appel : la fonction vide disparaît
|
||||
do $$ begin
|
||||
if not exists (
|
||||
select 1 from pg_proc p join pg_namespace n on n.oid = p.pronamespace
|
||||
where n.nspname = 'public' and p.proname <> 'azuu_notify' and p.prosrc ~ '\mazuu_notify\M'
|
||||
) then
|
||||
drop function if exists public.azuu_notify(uuid, text, uuid, text, text);
|
||||
end if;
|
||||
end $$;
|
||||
|
||||
-- 3) Table des notifications réduite à ce qui sert (abonnements) : anciennes colonnes et index retirés
|
||||
delete from public.notifications where kind not in ('new_follower', 'follow_request', 'unfollow', 'follow_accepted');
|
||||
alter table public.notifications drop constraint if exists notifications_kind_check;
|
||||
alter table public.notifications add constraint notifications_kind_check
|
||||
check (kind in ('new_follower', 'follow_request', 'unfollow', 'follow_accepted'));
|
||||
drop index if exists public.notifications_unpushed_idx;
|
||||
drop index if exists public.notifications_dedup_idx;
|
||||
alter table public.notifications
|
||||
drop column if exists item_id,
|
||||
drop column if exists emoji,
|
||||
drop column if exists episode,
|
||||
drop column if exists ep_count,
|
||||
drop column if exists dedup,
|
||||
drop column if exists pushed_at;
|
||||
Reference in new issue
Block a user