Files
Convivo/supabase/supplemental/community_day_2026_services.sql
T
Lago c0fbf495dc feat: sync GridSmart agendas and use event-relative demo time
Support script and URL sources, automatic Sessionize polling, staff-linked service sessions, chronological agenda blocks, and inline Placeholders. Fix demo mode to use the active event date and document deployed behavior with regression coverage.
2026-10-11 08:39:15 +02:00

38 lines
1.6 KiB
PL/PgSQL

\set ON_ERROR_STOP on
begin;
do $$
declare
target_event uuid;
target_slot integer;
target_session uuid;
entry record;
begin
select id into strict target_event from public.events
where is_active and name = 'Community Day 2026' and start_date = date '2026-10-23';
for entry in select * from (values
('Arrival & Coffee',time '08:30',time '09:00','manual-service-arrival-20261023'),
('Opening Keynote - TBC',time '09:00',time '10:00','manual-service-opening-20261023'),
('Lunch',time '12:00',time '13:00','manual-service-lunch-20261023'),
('Coffee Break',time '14:45',time '15:15','manual-service-coffee-20261023')
) as schedule(title,start_time,end_time,external_id) loop
select id into target_session from public.sessions
where event_id = target_event and external_id = entry.external_id;
if target_session is null then
select id into target_slot from public.slots
where event_id = target_event and slot_date = date '2026-10-23'
and start_time = entry.start_time and end_time = entry.end_time and type = 'service_session'
order by id limit 1;
if target_slot is null then
insert into public.slots(event_id,type,name,slot_date,start_time,end_time)
values(target_event,'service_session',entry.title,'2026-10-23',entry.start_time,entry.end_time)
returning id into target_slot;
end if;
insert into public.sessions(event_id,slot_id,title,external_id)
values(target_event,target_slot,entry.title,entry.external_id)
returning id into target_session;
end if;
perform public._assign_service_session_speakers(target_session,target_event);
end loop;
end;
$$;
commit;