CREATE TABLE IF NOT EXISTS zoho_tokens (
  id INT AUTO_INCREMENT PRIMARY KEY,
  access_token TEXT NOT NULL,
  api_domain VARCHAR(255) DEFAULT NULL,
  token_type VARCHAR(50) DEFAULT 'Bearer',
  expires_at DATETIME NOT NULL,
  updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

CREATE TABLE IF NOT EXISTS audit_log (
  id BIGINT AUTO_INCREMENT PRIMARY KEY,
  actor VARCHAR(190) NULL,
  action VARCHAR(190) NOT NULL,
  entity VARCHAR(190) NULL,
  entity_id VARCHAR(190) NULL,
  status VARCHAR(50) NOT NULL,
  detail TEXT NULL,
  created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
