plateforme-corres2math/setup/create_database.sql

146 lines
6.6 KiB
SQL

-- phpMyAdmin SQL Dump
-- version 4.7.5
-- https://www.phpmyadmin.net/
--
-- 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 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 NAMES utf8mb4 */;
--
-- Base de données : `inscription_corres2math`
--
CREATE DATABASE IF NOT EXISTS `inscription_corres2math` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `inscription_corres2math`;
-- --------------------------------------------------------
--
-- 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,
`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,
`allow_publish` tinyint(1) DEFAULT 0,
`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 */;