codex_erd

Tables (11)

tb_ai_analyze

  • analyze_id — BIGINT — Primary key — NOT NULL
  • model_id — BIGINT — Foreign key → tb_model_info.model_id — NOT NULL
  • part_id — BIGINT — Foreign key → tb_part.part_id — NOT NULL
  • analysis_time — DATETIME — NOT NULL
  • score — DECIMAL(10,6)
  • result_label — ENUM('normal', 'abnormal')
  • feature_json — JSON
  • created_at — DATETIME — NOT NULL

tb_alarm_info

  • alarm_id — BIGINT — Primary key — NOT NULL
  • user_num — BIGINT — Foreign key → tb_user_info.user_num — NOT NULL — 담당자
  • sensor_id — BIGINT — Foreign key → tb_sensor.sensor_id — 관련 센서
  • alarm_name — VARCHAR(255) — NOT NULL
  • alarm_content — TEXT — NOT NULL
  • alarm_type — ENUM('high', 'medium', 'low') — NOT NULL
  • alarm_status — ENUM('unconfirmed', 'confirmed', 'resolved', 'false_alarm') — NOT NULL
  • alarm_create_at — DATETIME — NOT NULL
  • alarm_resolve_at — DATETIME
  • created_at — DATETIME — NOT NULL
  • updated_at — DATETIME — NOT NULL

tb_alarm_notification_log

  • notification_id — BIGINT — Primary key — NOT NULL
  • alarm_id — BIGINT — Foreign key → tb_alarm_info.alarm_id — NOT NULL
  • channel — ENUM('email', 'slack') — NOT NULL
  • send_status — ENUM('success', 'failed', 'pending') — NOT NULL
  • sent_at — DATETIME
  • error_message — VARCHAR(500)
  • created_at — DATETIME — NOT NULL

tb_model_info

  • model_id — BIGINT — Primary key — NOT NULL
  • model_name — VARCHAR(255) — NOT NULL
  • model_version — VARCHAR(100) — NOT NULL
  • ideal_score — DECIMAL(8,4)
  • derived_variable — VARCHAR(255)
  • is_active — TINYINT(1) — NOT NULL
  • created_at — DATETIME — NOT NULL
  • updated_at — DATETIME — NOT NULL

tb_part

  • part_id — BIGINT — Primary key — NOT NULL — 부품 번호
  • plant_id — BIGINT — Foreign key → tb_power_plant.plant_id — NOT NULL — 발전기 FK
  • part_name — VARCHAR(255) — NOT NULL — 고압발전기, 터빈
  • part_code — VARCHAR(50) — NOT NULL — 예: 0001
  • part_type — VARCHAR(255) — NOT NULL — 예: MAC A, MAC B, BAC
  • created_at — DATETIME — NOT NULL
  • updated_at — DATETIME — NOT NULL

tb_power_plant

  • plant_id — BIGINT — Primary key — NOT NULL
  • station_id — BIGINT — Foreign key → tb_power_station.station_id — NOT NULL
  • plant_type — VARCHAR(100) — NOT NULL
  • plant_name — VARCHAR(255) — NOT NULL
  • fuel_type — VARCHAR(100) — NOT NULL
  • plant_status — ENUM('normal', 'caution', 'danger') — NOT NULL
  • diagnostic_status — ENUM('정상 운영', '주의', '위험') — NOT NULL
  • created_at — DATETIME — NOT NULL
  • updated_at — DATETIME — NOT NULL

tb_power_station

  • station_id — BIGINT — Primary key — NOT NULL
  • station_name — VARCHAR(255) — NOT NULL
  • station_lat — DECIMAL(10,7) — NOT NULL
  • station_lon — DECIMAL(10,7) — NOT NULL
  • station_add — VARCHAR(255) — NOT NULL
  • station_capacity — DECIMAL(12,2) — NOT NULL
  • created_at — DATETIME — NOT NULL
  • updated_at — DATETIME — NOT NULL

tb_prediction

  • prediction_id — BIGINT — Primary key — NOT NULL
  • sensor_id — BIGINT — Foreign key → tb_sensor.sensor_id — NOT NULL — 센서 FK
  • prediction_value — TINYINT(1) — NOT NULL — 정상/비정상 (0/1)
  • anomaly_score — DECIMAL(8, 5) — 이상 점수
  • prediction_time — DATETIME — NOT NULL
  • created_at — DATETIME — NOT NULL

tb_sensor

  • sensor_id — BIGINT — Primary key — NOT NULL — 센서 번호
  • part_id — BIGINT — Foreign key → tb_part.part_id — NOT NULL — 부품 FK
  • sensor_name — VARCHAR(100) — NOT NULL — 예: Vib_X, Temp
  • sensor_tag — VARCHAR(150) — 태그
  • unit — VARCHAR(30) — NOT NULL — 예: mm/s, °C, A
  • caution_threshold — DECIMAL(12, 4) — 주의 임계치
  • data_quality — ENUM('good', 'fair', 'poor') — NOT NULL
  • is_active — TINYINT(1) — NOT NULL
  • created_at — DATETIME — NOT NULL
  • updated_at — DATETIME — NOT NULL

tb_sensor_measurement

  • measurement_id — BIGINT — Primary key — NOT NULL
  • sensor_id — BIGINT — Foreign key → tb_sensor.sensor_id — NOT NULL
  • sensor_value — DECIMAL(14,6) — NOT NULL
  • sensor_time — DATETIME — NOT NULL
  • created_at — DATETIME — NOT NULL

tb_user_info

  • user_num — BIGINT — Primary key — NOT NULL — 유저 고유 번호
  • email — VARCHAR(255) — NOT NULL — 사용자 이메일
  • password_hash — VARCHAR(255) — NOT NULL — 해시 비밀번호
  • name — VARCHAR(100) — NOT NULL — 사용자 이름
  • permission — ENUM('admin', 'viewer', 'manager') — NOT NULL — 권한
  • team_name — VARCHAR(100) — 팀명
  • is_active — TINYINT(1) — NOT NULL
  • created_at — DATETIME — NOT NULL
  • updated_at — DATETIME — NOT NULL