From f17f68eb28b755c3e10639b9f71051bf5ab3fe36 Mon Sep 17 00:00:00 2001 From: galaxyoyo Date: Tue, 24 Sep 2019 00:14:55 +0200 Subject: [PATCH] =?UTF-8?q?Script=20de=20cr=C3=A9ation=20de=20la=20base=20?= =?UTF-8?q?de=20donn=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup/create_database.sql | 143 ++++++++++++++++++++++++++++++++++---- 1 file changed, 131 insertions(+), 12 deletions(-) diff --git a/setup/create_database.sql b/setup/create_database.sql index 351244c..65c0cf4 100644 --- a/setup/create_database.sql +++ b/setup/create_database.sql @@ -1,19 +1,21 @@ -- phpMyAdmin SQL Dump --- version 4.6.6deb4 +-- version 4.7.5 -- https://www.phpmyadmin.net/ -- --- Client : localhost:3306 --- Généré le : Dim 08 Septembre 2019 à 19:00 --- Version du serveur : 10.3.15-MariaDB-1 --- Version de PHP : 7.3.4-2 +-- Hôte : db +-- Généré le : lun. 23 sep. 2019 à 22:14 +-- Version du serveur : 5.7.20 +-- Version de PHP : 7.1.9 SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; -SET time_zone = "+02:00"; +SET AUTOCOMMIT = 0; +START TRANSACTION; +SET time_zone = "+00:00"; -/*!40101 SET @OLD_CHARACTER_SET_CLIENT = @@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS = @@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION = @@COLLATION_CONNECTION */; +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8mb4 */; -- @@ -22,6 +24,123 @@ SET time_zone = "+02:00"; CREATE DATABASE IF NOT EXISTS `inscription_corres2math` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; USE `inscription_corres2math`; -/*!40101 SET CHARACTER_SET_CLIENT = @OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS = @OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION = @OLD_COLLATION_CONNECTION */; +-- -------------------------------------------------------- + +-- +-- Structure de la table `config` +-- + +CREATE TABLE IF NOT EXISTS `config` ( + `key` varchar(64) NOT NULL, + `value` varchar(64) NOT NULL, + PRIMARY KEY (`key`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Structure de la table `documents` +-- + +CREATE TABLE IF NOT EXISTS `documents` ( + `file_id` varchar(64) NOT NULL, + `user` int(11) NOT NULL, + `team` int(11) NOT NULL, + `problem` int(11) NOT NULL, + `type` varchar(64) NOT NULL, + `uploaded_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`file_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Structure de la table `questions` +-- + +CREATE TABLE IF NOT EXISTS `questions` ( + `id` int(8) NOT NULL AUTO_INCREMENT, + `from` int(8) NOT NULL, + `to` int(8) NOT NULL, + `problem` int(8) NOT NULL, + `number` int(8) NOT NULL, + `question` varchar(1024) DEFAULT NULL, + `attached_file` varchar(64) DEFAULT NULL, + `answer` varchar(1024) DEFAULT NULL, + `attached_file_answer` varchar(64) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Structure de la table `teams` +-- + +CREATE TABLE IF NOT EXISTS `teams` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(64) NOT NULL, + `trigram` varchar(3) NOT NULL, + `problem` int(8) NOT NULL, + `encadrant` int(8) DEFAULT NULL, + `participant_1` int(8) DEFAULT NULL, + `participant_2` int(8) DEFAULT NULL, + `participant_3` int(8) DEFAULT NULL, + `participant_4` int(8) DEFAULT NULL, + `participant_5` int(8) DEFAULT NULL, + `inscription_date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + `validation_status` varchar(64) NOT NULL, + `video_team1` int(11) DEFAULT NULL, + `video_team2` int(11) DEFAULT NULL, + `access_code` varchar(6) NOT NULL, + `year` int(4) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Structure de la table `users` +-- + +CREATE TABLE IF NOT EXISTS `users` ( + `id` int(8) NOT NULL AUTO_INCREMENT, + `email` varchar(255) NOT NULL, + `pwd_hash` varchar(64) NOT NULL, + `surname` varchar(255) NOT NULL, + `first_name` varchar(255) NOT NULL, + `school` varchar(255) DEFAULT NULL, + `class` varchar(255) DEFAULT NULL, + `description` varchar(255) DEFAULT NULL, + `role` varchar(64) NOT NULL, + `team_id` int(8) DEFAULT NULL, + `receive_animath_mails` tinyint(1) NOT NULL DEFAULT '0', + `year` int(4) NOT NULL DEFAULT '2020', + `confirm_email` varchar(64) DEFAULT NULL COMMENT 'Jeton de confirmation d''e-mail', + `forgotten_password` varchar(64) DEFAULT NULL COMMENT 'Jeton de récupération de mot de passe', + `inscription_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Structure de la table `videos` +-- + +CREATE TABLE IF NOT EXISTS `videos` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `team` int(8) NOT NULL, + `problem` int(8) NOT NULL, + `link` varchar(128) NOT NULL, + `reason` varchar(64) NOT NULL, + `validation` tinyint(1) NOT NULL DEFAULT '0', + `uploaded_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `year` int(4) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8; +COMMIT; + +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; \ No newline at end of file