-- StaatsHub Logs Tabelle
-- Speichert Logs vom Control Panel und Keybinder (StaatsHub.exe)

CREATE TABLE IF NOT EXISTS `staatshub_logs` (
  `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  `type` ENUM('Control Panel', 'Keybinder') NOT NULL DEFAULT 'Control Panel',
  `username` VARCHAR(50) NOT NULL,
  `target` VARCHAR(50) DEFAULT NULL,
  `aktion` VARCHAR(500) NOT NULL,
  `beschreibung` TEXT,
  `fractionid` INT(11) UNSIGNED NOT NULL DEFAULT 0,
  `time` VARCHAR(50) NOT NULL,
  `created_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_fractionid` (`fractionid`),
  KEY `idx_type` (`type`),
  KEY `idx_username` (`username`),
  KEY `idx_target` (`target`),
  KEY `idx_created_at` (`created_at`),
  KEY `idx_fractionid_type` (`fractionid`, `type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

