-- ==========================================
-- Редактирование учебных групп
-- ==========================================

ALTER TABLE student_groups
ADD COLUMN IF NOT EXISTS specialty_code INT REFERENCES specialties(id);

UPDATE student_groups
SET specialty_code = 1
WHERE specialty_code IS NULL;

ALTER TABLE student_groups
ALTER COLUMN specialty_code SET NOT NULL;

-- ==========================================
-- Редактирование данных для расписания
-- ==========================================

INSERT INTO schedule_data (department_id, semester, group_id, subjects_id, lesson_type_id, number_of_hours, is_division, teacher_id, semester_type, period)
VALUES (1, 1, 1, 1, 3, 2, true, 1, 'autumn', '2024-2025'),
       (2, 4, 2, 3, 2, 1, false, 2, 'spring', '2025-2026'),
       (3, 5, 1, 2, 1, 3, true, 1, 'autumn', '2023-2024'),
       (2, 4, 2, 3, 2, 1, false, 2, 'spring', '2025-2026'),
       (2, 4, 2, 3, 2, 1, false, 2, 'spring', '2025-2026'),
       (2, 4, 2, 3, 2, 1, false, 2, 'spring', '2025-2026'),
       (1, 1, 1, 1, 1, 2, true, 2, 'autumn', '2024-2025'),
       (1, 2, 2, 2, 3, 4, false, 2, 'autumn', '2024-2025'),
       (1, 3, 1, 4, 2, 1, false, 1, 'autumn', '2024-2025'),
       (1, 4, 2, 5, 1, 7, true, 1, 'autumn', '2024-2025');