CREATE TABLE IF NOT EXISTS handlaggare_daily_logs (
  id             VARCHAR(36)  PRIMARY KEY,
  handlaggare_id VARCHAR(36)  NOT NULL,
  date           DATE         NOT NULL,
  log_json       JSON         NOT NULL DEFAULT (JSON_ARRAY()),
  updated_at     DATETIME     DEFAULT NOW() ON UPDATE NOW(),
  UNIQUE KEY uq_handlaggare_date (handlaggare_id, date),
  FOREIGN KEY (handlaggare_id) REFERENCES handlaggare(id) ON DELETE CASCADE
);
