CREATE TABLE IF NOT EXISTS rekognition_customer_profile_events (
  id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
  customer_id BIGINT UNSIGNED NOT NULL,
  event_year SMALLINT UNSIGNED NULL,
  event_name VARCHAR(255) NOT NULL,
  note TEXT NULL,
  created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  KEY idx_customer_profile_events_customer_id (customer_id),
  KEY idx_customer_profile_events_year (event_year),
  KEY idx_customer_profile_events_name (event_name),
  CONSTRAINT fk_customer_profile_events_customer_id
    FOREIGN KEY (customer_id) REFERENCES rekognition_customer_profiles(id)
    ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
