-- =====================================================
-- Cleanup Test Data for meeting-test
-- =====================================================

-- 1. agenda_sections 삭제 (외래키 제약이 있을 수 있으므로 먼저)
DELETE FROM agenda_sections WHERE meeting_id = 'meeting-test';

-- 2. todos 삭제
DELETE FROM todos WHERE meeting_id = 'meeting-test';

-- 3. meeting_analysis 관련 삭제
DELETE FROM meeting_keywords WHERE analysis_id IN (SELECT analysis_id FROM meeting_analysis WHERE meeting_id = 'meeting-test');
DELETE FROM meeting_analysis WHERE meeting_id = 'meeting-test';

-- 4. minutes_sections 삭제
DELETE FROM minutes_sections WHERE minutes_id IN (SELECT minutes_id FROM minutes WHERE meeting_id = 'meeting-test');

-- 5. minutes 삭제
DELETE FROM minutes WHERE meeting_id = 'meeting-test';

-- 6. 확인
SELECT 'Cleanup completed' AS status;
SELECT COUNT(*) as remaining_minutes FROM minutes WHERE meeting_id = 'meeting-test';
SELECT COUNT(*) as remaining_sections FROM minutes_sections WHERE minutes_id IN (SELECT minutes_id FROM minutes WHERE meeting_id = 'meeting-test');
SELECT COUNT(*) as remaining_agenda FROM agenda_sections WHERE meeting_id = 'meeting-test';
SELECT COUNT(*) as remaining_todos FROM todos WHERE meeting_id = 'meeting-test';
