-- BEGIN CHANGE: tabela audit log do painel admin (criada tambem auto pela API)
CREATE TABLE IF NOT EXISTS `z_admin_audit` (
  `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `admin_id` INT UNSIGNED NOT NULL,
  `admin_name` VARCHAR(64) NOT NULL DEFAULT '',
  `action` VARCHAR(64) NOT NULL,
  `target_account_id` INT UNSIGNED NULL DEFAULT NULL,
  `target_player_id` INT UNSIGNED NULL DEFAULT NULL,
  `target_label` VARCHAR(128) NOT NULL DEFAULT '',
  `detail_json` MEDIUMTEXT NULL,
  `ip` VARCHAR(45) NOT NULL DEFAULT '',
  `created_at` INT UNSIGNED NOT NULL,
  PRIMARY KEY (`id`),
  KEY `idx_created` (`created_at`),
  KEY `idx_admin` (`admin_id`),
  KEY `idx_action` (`action`),
  KEY `idx_target_acc` (`target_account_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- END CHANGE
