CREATE TABLE IF NOT EXISTS order_actions (
  id VARCHAR(36) NOT NULL,
  order_id VARCHAR(36) NOT NULL,
  action VARCHAR(64) NOT NULL,
  source_type VARCHAR(32) NOT NULL,
  provider VARCHAR(64) NULL,
  status VARCHAR(32) NOT NULL,
  operator_id VARCHAR(36) NULL,
  request_payload JSON NULL,
  response_payload JSON NULL,
  error_message VARCHAR(500) NULL,
  remark VARCHAR(500) NULL,
  created_at DATETIME(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6),
  PRIMARY KEY (id),
  KEY idx_order_actions_order_id (order_id, created_at),
  KEY idx_order_actions_action_created (action, created_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
