CREATE TABLE ns20_1_ai_report (
  id INT AUTO_INCREMENT PRIMARY KEY,

  deviceid VARCHAR(20) NOT NULL,
  farm_name VARCHAR(50) NOT NULL,
  crop_type VARCHAR(20) NOT NULL,

  report_date DATE NOT NULL,
  report_time TIME NOT NULL,          -- ⭐ 하루 다회 분석 대비

  env_status ENUM('적정','주의','위험') NOT NULL,  -- ⭐ 핵심 판단
  summary VARCHAR(255) NOT NULL,       -- ⭐ 한 줄 요약 (관리자용)

  json_file VARCHAR(150) NOT NULL,

  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,

  INDEX idx_device_date (deviceid, report_date),
  INDEX idx_status_date (env_status, report_date)
);
