diff --git a/scripts/r6_cleanup_v2.sql b/scripts/r6_cleanup_v2.sql new file mode 100644 index 0000000..445a039 --- /dev/null +++ b/scripts/r6_cleanup_v2.sql @@ -0,0 +1,39 @@ +-- R6 cleanup v2 — additional klubovi fixed using broader civic.entities search +-- Author: dradulic@outlook.com / damir@rinet.one +-- Date: 2026-05-05 +-- Run after: scripts/cleanup_garbage_clubs.py +-- +-- Identifies clubs the original Round-4 cleanup left as [VERIFY], then fixes +-- those that match civic.entities by relaxed (non-odbojka) address search. + +BEGIN; + +-- 2636: Sv. Križ 24, Rijeka (civic.entity 114850 odbojkaška akademija Petica) +UPDATE pgz_sport.klubovi +SET naziv = 'Odbojkaški Klub "Odbojkaška Akademija Petica"', + oib = COALESCE(NULLIF(oib,''), '40538276343'), + metadata = COALESCE(metadata,'{}'::jsonb) + || jsonb_build_object( + 'cleanup_at_v2', now()::text, + 'cleanup_source_v2', 'civic.entities#114850 (broader address match)', + 'manual_review', false) +WHERE id = 2636; + +-- 2641: Kotorska 15a, Crikvenica (civic.entity 78781 ŽOK Crikvenica) +UPDATE pgz_sport.klubovi +SET naziv = 'Ženski Odbojkaški Klub "Crikvenica"', + oib = COALESCE(NULLIF(oib,''), '17195966673'), + metadata = COALESCE(metadata,'{}'::jsonb) + || jsonb_build_object( + 'cleanup_at_v2', now()::text, + 'cleanup_source_v2', 'civic.entities#78781 (filtered odbojka at Kotorska 15a)', + 'manual_review', false) +WHERE id = 2641; + +COMMIT; + +-- Status check +SELECT id, naziv, metadata->>'manual_review' AS needs_review +FROM pgz_sport.klubovi +WHERE id IN (2613,2616,2618,2619,2622,2624,2626,2630,2632,2634,2636,2638,2641,2643) +ORDER BY id;