alu-chatbot / migrate_alu_curators.sql
Donne120
Claude Sonnet 5
chore(curators): migrate ALU's real Mission Curators out of frontend source
b3f9c33
Raw History Blame Contribute Delete
2.73 kB
-- One-time data migration: move ALU's real Mission Curators out of
-- frontend/src/components/mini-chatbot/mockData.tsx (hardcoded source) and
-- into Aurora's curators table, where they belong to ALU's organization_id
-- and are reachable via the new admin-managed /admin/curators and
-- student-facing /curators endpoints.
--
-- Run this once against the live Aurora cluster (CloudShell + psql), AFTER
-- schema_curator_booking_links.sql has been applied. Uses ON CONFLICT-style
-- guards via a NOT EXISTS check so it's safe to re-run without creating
-- duplicates if it's ever run twice.
--
-- Source data verified against mockData.tsx's `departments` export
-- (8 real curators with real @alueducation.com emails and real booking
-- links) as of this migration's creation — NOT the `learningCoaches` array,
-- which is explicitly placeholder/demo data (Nelson Mandela, Kofi Annan,
-- etc.) and is being cleaned up separately, not migrated.
DO $$
DECLARE
alu_org_id uuid;
BEGIN
SELECT id INTO alu_org_id FROM organizations WHERE email_domain = 'alustudent.com';
IF alu_org_id IS NULL THEN
RAISE EXCEPTION 'ALU organization not found (email_domain = alustudent.com) — aborting migration';
END IF;
INSERT INTO curators (organization_id, name, mission_area, role_title, email, calendar_link, is_bookable)
SELECT alu_org_id, v.name, v.mission_area, v.role_title, v.email, v.calendar_link, true
FROM (VALUES
('Fred Nkubito', 'Urbanization & Infrastructure', NULL, 'fnkubito@alueducation.com', 'https://calendar.app.google/ND451LWXxbJ7N4Wq9'),
('Kagenza Rumongi', 'Governance', NULL, 'krumongi@alueducation.com', 'https://calendly.com/kagenzar'),
('Elizabeth Ndinda', 'Education', NULL, 'endinda@alueducation.com', NULL),
('Sevika Varaden Reetoo', 'Climate Change', NULL, 'sreetoo@alueducation.com', 'https://calendar.app.google/aUYL6assM7VNA7WS7'),
('Sibongile Musundwa', 'Arts, Culture & Design', NULL, 'smusundwa@alueducation.com', 'https://calendar.app.google/6hMsRRQXPkNrzFhJA'),
('Bosede Funmi Akinbolusere', 'Women Empowerment & Gender Equality', NULL, 'bakinbolusere@alueducation.com', NULL),
('Brian Nicholas Neza', 'Agriculture', NULL, 'bneza@alueducation.com', 'https://sites.google.com/alueducation.com/aluknowledgemanagementportal/g-c-g-o/agriculture?authuser=0#h.4hyangxnbbcr'),
('Arnaud Michel Nibaruta', NULL, 'BEL Program Manager — Office Hours', NULL, 'https://calendar.app.google/5js5KrCpeonqMfQN8')
) AS v(name, mission_area, role_title, email, calendar_link)
WHERE NOT EXISTS (
SELECT 1 FROM curators c
WHERE c.organization_id = alu_org_id AND c.name = v.name
);
END $$;