-- AlterTable ALTER TABLE "lms_notifications" ADD COLUMN "audience" TEXT NOT NULL DEFAULT 'all'; -- Existing admin messages are instructor-facing. UPDATE "lms_notifications" SET "audience" = 'instructor' WHERE "id" IN ( 'lms-notification-course-review', 'lms-notification-live-session', 'lms-notification-system-maintenance' ); -- Seed student messages. INSERT INTO "lms_notifications" ("id", "title", "body", "category", "audience", "created_at", "updated_at") VALUES ('lms-student-notification-assignment-due', '과제 제출 마감 안내', '인지 실습 리포트 제출 마감이 오늘 18:00까지입니다.', 'assignment', 'student', '2026-06-02T00:00:00.000Z', CURRENT_TIMESTAMP), ('lms-student-notification-new-lesson', '신규 강의 공개', '자율주행 센서 융합 기초 강의가 새로 공개되었습니다.', 'course', 'student', '2026-06-01T00:00:00.000Z', CURRENT_TIMESTAMP), ('lms-student-notification-session', '실습 세션 안내', '내일 10:00에 ROS2 실습 세션이 예정되어 있습니다.', 'schedule', 'student', '2026-05-31T00:00:00.000Z', CURRENT_TIMESTAMP); -- CreateIndex CREATE INDEX "lms_notifications_audience_is_active_created_at_idx" ON "lms_notifications"("audience", "is_active", "created_at");