-- 알림 수신자 설정 테이블 -- 알림 유형별로 지정된 사용자에게만 알림이 전송됨 CREATE TABLE IF NOT EXISTS notification_recipients ( id INT AUTO_INCREMENT PRIMARY KEY, notification_type ENUM('repair', 'safety', 'nonconformity', 'equipment', 'maintenance', 'system') NOT NULL COMMENT '알림 유형', user_id INT NOT NULL COMMENT '수신자 ID', is_active BOOLEAN DEFAULT TRUE COMMENT '활성 여부', created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, created_by INT NULL COMMENT '등록자', UNIQUE KEY unique_type_user (notification_type, user_id), FOREIGN KEY (user_id) REFERENCES users(user_id) ON DELETE CASCADE, INDEX idx_nr_type (notification_type), INDEX idx_nr_active (is_active) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='알림 수신자 설정'; -- 알림 유형 설명: -- repair: 설비 수리 신청 -- safety: 안전 신고 -- nonconformity: 부적합 신고 -- equipment: 설비 관련 -- maintenance: 정기점검 -- system: 시스템 알림