CREATE TABLE IF NOT EXISTS `server_permissions` (
    `id`               INT UNSIGNED NOT NULL AUTO_INCREMENT,
    `server_id`        INT UNSIGNED NOT NULL,
    `permission_type`  ENUM('sudo', 'command', 'file_read', 'file_write', 'custom') NOT NULL,
    `permission_value` VARCHAR(255) NOT NULL,
    `description`      VARCHAR(255) DEFAULT NULL,
    `created_at`       DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`),
    KEY `idx_server_id` (`server_id`),
    CONSTRAINT `fk_permissions_server` FOREIGN KEY (`server_id`) REFERENCES `servers` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
