Files
Telereview/code/db/telereview.sql
2023-04-02 20:28:12 +02:00

429 lines
9.5 KiB
SQL

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
--
-- Database: `telereview`
--
CREATE DATABASE IF NOT EXISTS `telereview`;
USE `telereview`;
-- --------------------------------------------------------
--
-- Table structure for table `borne_auteurs`
--
CREATE TABLE `borne_auteurs` (
`id` int NOT NULL,
`sexe` tinytext ,
`age` tinyint DEFAULT NULL
) ;
-- --------------------------------------------------------
--
-- Table structure for table `borne_avis`
--
CREATE TABLE `borne_avis` (
`id` int NOT NULL,
`id_auteur` int NOT NULL,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`note_principale` tinyint NOT NULL,
`commentaire` text NOT NULL,
`source_id` int NOT NULL
) ;
-- --------------------------------------------------------
--
-- Table structure for table `borne_criteres`
--
CREATE TABLE `borne_criteres` (
`id` int NOT NULL,
`nom` text NOT NULL
) ;
--
-- Dumping data for table `borne_criteres`
--
INSERT INTO `borne_criteres` (`id`, `nom`) VALUES
(1, 'analyse');
(2, 'proprete'),
(3, 'calme'),
(4, 'attente');
-- --------------------------------------------------------
--
-- Table structure for table `borne_notes_autre`
--
CREATE TABLE `borne_notes_autre` (
`id` int NOT NULL,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`critere_id` int NOT NULL,
`avis_id` int NOT NULL,
`note` float NOT NULL COMMENT 'Note sur 10'
) ;
-- --------------------------------------------------------
--
-- Table structure for table `reseaux_sociaux_auteurs`
--
CREATE TABLE `reseaux_sociaux_auteurs` (
`id` int NOT NULL,
`nom_utilisateur` text NOT NULL,
`source_id` int NOT NULL,
`lien` text NOT NULL
) ;
-- --------------------------------------------------------
--
-- Table structure for table `reseaux_sociaux_avis`
--
CREATE TABLE `reseaux_sociaux_avis` (
`id` int NOT NULL,
`date` date NOT NULL,
`source_id` int NOT NULL,
`note` tinyint DEFAULT NULL,
`commentaire` text ,
`auteur_id` int NOT NULL,
`lien_source` text
) ;
-- --------------------------------------------------------
--
-- Table structure for table `sources`
--
CREATE TABLE `sources` (
`id` int NOT NULL,
`nom` text NOT NULL
) ;
--
-- Dumping data for table `sources`
--
INSERT INTO `sources` (`id`, `nom`) VALUES
(1, 'website'),
(2, 'borne');
-- --------------------------------------------------------
--
-- Table structure for table `stats_autres_annee`
--
CREATE TABLE `stats_autres_annee` (
`id` int NOT NULL,
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`critere_id` int NOT NULL,
`note` float NOT NULL
) ;
-- --------------------------------------------------------
--
-- Table structure for table `stats_autres_jour`
--
CREATE TABLE `stats_autres_jour` (
`id` int NOT NULL,
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`critere_id` int NOT NULL,
`note` float NOT NULL
) ;
-- --------------------------------------------------------
--
-- Table structure for table `stats_autres_mois`
--
CREATE TABLE `stats_autres_mois` (
`id` int NOT NULL,
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`critere_id` int NOT NULL,
`note` float NOT NULL
) ;
-- --------------------------------------------------------
--
-- Table structure for table `stats_autres_semaine`
--
CREATE TABLE `stats_autres_semaine` (
`id` int NOT NULL,
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`critere_id` int NOT NULL,
`note` float NOT NULL
) ;
-- --------------------------------------------------------
--
-- Table structure for table `stats_general_annee`
--
CREATE TABLE `stats_general_annee` (
`id` int NOT NULL,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`nb_avis` int NOT NULL,
`moyenne_globale` float DEFAULT NULL,
`moyenne_site` float DEFAULT NULL,
`moyenne_borne` float DEFAULT NULL,
`dist_age` text DEFAULT NULL COMMENT 'Distribution de l''age des auteurs',
`dist_sexe` text DEFAULT NULL COMMENT 'Distribution du sexe des auteurs'
) ;
-- --------------------------------------------------------
--
-- Table structure for table `stats_general_jour`
--
CREATE TABLE `stats_general_jour` (
`id` int NOT NULL,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`nb_avis` int NOT NULL,
`moyenne_globale` float DEFAULT NULL,
`moyenne_site` float DEFAULT NULL,
`moyenne_borne` float DEFAULT NULL,
`dist_age` text DEFAULT NULL COMMENT 'Distribution de l''age des auteurs',
`dist_sexe` text DEFAULT NULL COMMENT 'Distribution du sexe des auteurs'
) ;
-- --------------------------------------------------------
--
-- Table structure for table `stats_general_mois`
--
CREATE TABLE `stats_general_mois` (
`id` int NOT NULL,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`nb_avis` int NOT NULL,
`moyenne_globale` float DEFAULT NULL,
`moyenne_site` float DEFAULT NULL,
`moyenne_borne` float DEFAULT NULL,
`dist_age` text DEFAULT NULL COMMENT 'Distribution de l''age des auteurs',
`dist_sexe` text DEFAULT NULL COMMENT 'Distribution du sexe des auteurs'
) ;
-- --------------------------------------------------------
--
-- Table structure for table `stats_general_semaine`
--
CREATE TABLE `stats_general_semaine` (
`id` int NOT NULL,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`nb_avis` int NOT NULL,
`moyenne_globale` float DEFAULT NULL,
`moyenne_site` float DEFAULT NULL,
`moyenne_borne` float DEFAULT NULL,
`dist_age` text DEFAULT NULL COMMENT 'Distribution de l''age des auteurs',
`dist_sexe` text DEFAULT NULL COMMENT 'Distribution du sexe des auteurs'
) ;
--
-- Indexes for dumped tables
--
--
-- Indexes for table `borne_auteurs`
--
ALTER TABLE `borne_auteurs`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `borne_avis`
--
ALTER TABLE `borne_avis`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `borne_criteres`
--
ALTER TABLE `borne_criteres`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `borne_notes_autre`
--
ALTER TABLE `borne_notes_autre`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `reseaux_sociaux_auteurs`
--
ALTER TABLE `reseaux_sociaux_auteurs`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `reseaux_sociaux_avis`
--
ALTER TABLE `reseaux_sociaux_avis`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `sources`
--
ALTER TABLE `sources`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `stats_autres_annee`
--
ALTER TABLE `stats_autres_annee`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `stats_autres_jour`
--
ALTER TABLE `stats_autres_jour`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `stats_autres_mois`
--
ALTER TABLE `stats_autres_mois`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `stats_autres_semaine`
--
ALTER TABLE `stats_autres_semaine`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `stats_general_annee`
--
ALTER TABLE `stats_general_annee`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `stats_general_jour`
--
ALTER TABLE `stats_general_jour`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `stats_general_mois`
--
ALTER TABLE `stats_general_mois`
ADD PRIMARY KEY (`id`);
--
-- Indexes for table `stats_general_semaine`
--
ALTER TABLE `stats_general_semaine`
ADD PRIMARY KEY (`id`);
--
-- AUTO_INCREMENT for dumped tables
--
--
-- AUTO_INCREMENT for table `borne_auteurs`
--
ALTER TABLE `borne_auteurs`
MODIFY `id` int NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `borne_avis`
--
ALTER TABLE `borne_avis`
MODIFY `id` int NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `borne_criteres`
--
ALTER TABLE `borne_criteres`
MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `borne_notes_autre`
--
ALTER TABLE `borne_notes_autre`
MODIFY `id` int NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `reseaux_sociaux_auteurs`
--
ALTER TABLE `reseaux_sociaux_auteurs`
MODIFY `id` int NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `reseaux_sociaux_avis`
--
ALTER TABLE `reseaux_sociaux_avis`
MODIFY `id` int NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `sources`
--
ALTER TABLE `sources`
MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT for table `stats_autres_annee`
--
ALTER TABLE `stats_autres_annee`
MODIFY `id` int NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `stats_autres_jour`
--
ALTER TABLE `stats_autres_jour`
MODIFY `id` int NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `stats_autres_mois`
--
ALTER TABLE `stats_autres_mois`
MODIFY `id` int NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `stats_autres_semaine`
--
ALTER TABLE `stats_autres_semaine`
MODIFY `id` int NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `stats_general_annee`
--
ALTER TABLE `stats_general_annee`
MODIFY `id` int NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `stats_general_jour`
--
ALTER TABLE `stats_general_jour`
MODIFY `id` int NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `stats_general_mois`
--
ALTER TABLE `stats_general_mois`
MODIFY `id` int NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `stats_general_semaine`
--
ALTER TABLE `stats_general_semaine`
MODIFY `id` int NOT NULL AUTO_INCREMENT;
COMMIT;