CREATE TABLE IF NOT EXISTS rekognition_customer_profile_key_insights (
  id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  customer_id BIGINT UNSIGNED NOT NULL,
  insight_key VARCHAR(255) NOT NULL,
  insight_value TEXT NULL,
  sort_order INT UNSIGNED NOT NULL DEFAULT 0,
  created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (id),
  KEY idx_profile_key_insights_customer (customer_id, sort_order),
  CONSTRAINT fk_profile_key_insights_customer
    FOREIGN KEY (customer_id) REFERENCES rekognition_customer_profiles (id)
    ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
