/*
SQLyog Community v13.1.7 (64 bit)
MySQL - 10.6.4-MariaDB : Database - ptsdata
*********************************************************************
*/

/*!40101 SET NAMES utf8 */;

/*!40101 SET SQL_MODE=''*/;

/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`analyse` /*!40100 DEFAULT CHARACTER SET utf8mb3 */;

USE `analyse`;

DROP TABLE IF EXISTS `api_measurements`;
DROP TABLE IF EXISTS `api_results`;
DROP TABLE IF EXISTS `api_info`;
DROP TABLE IF EXISTS `api_configurations`;

/*Table structure for table `api_configurations` */
CREATE TABLE `api_configurations` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `time` bigint(20) unsigned NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*Data for the table `api_configurations` */

/*Table structure for table `api_info` */
CREATE TABLE `api_info` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `name` varchar(80) NOT NULL,
  `value` text NOT NULL,
  `config_id` bigint(20) unsigned NOT NULL,
  CONSTRAINT
    FOREIGN KEY (config_id) REFERENCES api_configurations (id)
    ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*Data for the table `api_info` */

/*Table structure for table `api_results` */
CREATE TABLE `api_results` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `status` varchar(40) NOT NULL,
  `time` bigint(20) unsigned NOT NULL,
  `config_id` bigint(20) unsigned NOT NULL,
  CONSTRAINT
    FOREIGN KEY (config_id) REFERENCES api_configurations (id)
    ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*Data for the table `api_results` */

/*Table structure for table `api_measurements` */
CREATE TABLE `api_measurements` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `name` varchar(100) NOT NULL,
  `value` float NOT NULL,
  `result_id` bigint(20) unsigned NOT NULL,
  `rights` varchar(32),
  CONSTRAINT
    FOREIGN KEY (result_id) REFERENCES api_results (id)
    ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
/*Data for the table `api_measurements` */

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
