/*
 Navicat Premium Data Transfer

 Source Server         : EnviroGenAI-API
 Source Server Type    : MySQL
 Source Server Version : 50742
 Source Host           : 52.235.21.182:3306
 Source Schema         : envirogenaiapi

 Target Server Type    : MySQL
 Target Server Version : 50742
 File Encoding         : 65001

 Date: 17/02/2024 12:22:38
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for admin_execute_log
-- ----------------------------
DROP TABLE IF EXISTS `admin_execute_log`;
CREATE TABLE `admin_execute_log`  (
  `arg` varchar(80) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
  `command` varchar(30) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
  `execution_time` datetime(0) NOT NULL,
  `message` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
  `success` tinyint(2) NOT NULL COMMENT '1: oui; 2: non',
  `user_id` int(10) UNSIGNED NOT NULL
) ENGINE = MyISAM CHARACTER SET = latin1 COLLATE = latin1_swedish_ci;

-- ----------------------------
-- Table structure for api
-- ----------------------------
DROP TABLE IF EXISTS `api`;
CREATE TABLE `api`  (
  `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  `api_args` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
  `api_datetime` datetime(0) NOT NULL,
  `api_error` smallint(3) NOT NULL,
  `api_ip` varchar(15) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
  `api_name` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
  `api_query_string` varchar(1024) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
  `api_referer` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
  `api_request_method` varchar(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
  `api_user_id` varchar(40) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '',
  `api_user_key` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 299 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci;

-- ----------------------------
-- Table structure for config
-- ----------------------------
DROP TABLE IF EXISTS `config`;
CREATE TABLE `config`  (
  `name` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
  `value` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '',
  `comment` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
  PRIMARY KEY (`name`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci;

-- ----------------------------
-- Records of config
-- ----------------------------
BEGIN;
INSERT INTO `config` VALUES ('gGPT_CHATGPT_ENABLED', '1', NULL), ('gGPT_CHATGPT_MODEL', 'gpt-3.5-turbo', NULL), ('gGPT_COMP_MODE_ENABLED', '1', NULL), ('gGPT_MESSAGE_ROLE_SYSTEM', '1', 'Voir classe GPTMessageRole.'), ('gGPT_SERVICE_DEFAULT', 'chatgpt', 'Une valeur de la classe GPTService.'), ('gGPT_WRITESONIC_ENABLED', '1', NULL), ('gGPT_WRITESONIC_MODEL', 'average', NULL);
COMMIT;

-- ----------------------------
-- Table structure for error
-- ----------------------------
DROP TABLE IF EXISTS `error`;
CREATE TABLE `error`  (
  `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  `error_id` varchar(30) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
  `function` varchar(80) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
  `hostname` varchar(80) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
  `insertion_datetime` datetime(0) NULL DEFAULT NULL,
  `ip` varchar(15) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
  `line` int(10) NULL DEFAULT NULL,
  `message` varchar(256) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
  `option` varchar(80) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
  `script` varchar(40) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
  `timestamp` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0),
  `user_id` varchar(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
  PRIMARY KEY (`id`) USING BTREE,
  INDEX `error_id`(`error_id`) USING BTREE
) ENGINE = MyISAM AUTO_INCREMENT = 134 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci;

-- ----------------------------
-- Table structure for gpt_request
-- ----------------------------
DROP TABLE IF EXISTS `gpt_request`;
CREATE TABLE `gpt_request`  (
  `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
  `insert_datetime` datetime(0) NOT NULL,
  `prompt` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
  `response` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
  `service` char(1) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COMMENT 'Le 1er caractere du nom interne du service.',
  `service_model` char(1) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' COMMENT 'Un caractère décrivant le modèle, l\'engine,etc..',
  `tokens_nb` int(255) UNSIGNED NOT NULL DEFAULT 0,
  `user_id` varchar(40) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL COMMENT 'API user id.',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 515 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci;

-- ----------------------------
-- Table structure for log
-- ----------------------------
DROP TABLE IF EXISTS `log`;
CREATE TABLE `log`  (
  `email` varchar(80) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
  `hostname` varchar(80) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
  `ip` varchar(15) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL,
  `login_time` datetime(0) NOT NULL
) ENGINE = MyISAM CHARACTER SET = latin1 COLLATE = latin1_swedish_ci;

SET FOREIGN_KEY_CHECKS = 1;
