CREATE TABLE IF NOT EXISTS `glpi_plugin_urbackup_configs` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` VARCHAR(255) NOT NULL DEFAULT '',
  `value` TEXT DEFAULT NULL,
  `date_creation` TIMESTAMP NULL DEFAULT NULL,
  `date_mod` TIMESTAMP NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;

CREATE TABLE IF NOT EXISTS `glpi_plugin_urbackup_servers` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `entities_id` INT UNSIGNED NOT NULL DEFAULT 0,
  `is_recursive` TINYINT NOT NULL DEFAULT 0,
  `name` VARCHAR(255) NOT NULL DEFAULT '',
  `locations_id` INT UNSIGNED NOT NULL DEFAULT 0,
  `users_id` INT UNSIGNED NOT NULL DEFAULT 0,
  `ip_address` VARCHAR(255) NOT NULL DEFAULT '',
  `port` INT UNSIGNED NOT NULL DEFAULT 55414,
  `protocol` VARCHAR(10) NOT NULL DEFAULT 'http',
  `server_version` VARCHAR(64) DEFAULT NULL,
  `api_username` VARCHAR(255) DEFAULT NULL,
  `api_password` TEXT DEFAULT NULL,
  `ignore_ssl` TINYINT NOT NULL DEFAULT 0,
  `is_active` TINYINT NOT NULL DEFAULT 1,
  `last_api_status` TINYINT NOT NULL DEFAULT 0,
  `last_api_message` TEXT DEFAULT NULL,
  `last_api_check` TIMESTAMP NULL DEFAULT NULL,
  `comment` TEXT DEFAULT NULL,
  `date_creation` TIMESTAMP NULL DEFAULT NULL,
  `date_mod` TIMESTAMP NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `name` (`name`),
  KEY `entities_id` (`entities_id`),
  KEY `locations_id` (`locations_id`),
  KEY `users_id` (`users_id`),
  KEY `is_active` (`is_active`),
  KEY `location_active` (`locations_id`, `is_active`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;

CREATE TABLE IF NOT EXISTS `glpi_plugin_urbackup_serverassets` (
  `id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
  `plugin_urbackup_servers_id` INT UNSIGNED NOT NULL DEFAULT 0,
  `itemtype` VARCHAR(255) NOT NULL DEFAULT '',
  `items_id` INT UNSIGNED NOT NULL DEFAULT 0,
  `date_creation` TIMESTAMP NULL DEFAULT NULL,
  `date_mod` TIMESTAMP NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `plugin_urbackup_servers_id` (`plugin_urbackup_servers_id`),
  KEY `item` (`itemtype`, `items_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;

-- glpi_plugin_urbackup_profiles was dropped in 0.7.0 (replaced by Profile::registerRights())