MAJ
This commit is contained in:
parent
300c9716dc
commit
de07901bc7
@ -15,3 +15,4 @@ Dans /conteneur
|
|||||||
*applicatif: a faire
|
*applicatif: a faire
|
||||||
*CPU, RAM... donc on renvoie les metrics avec node exporter
|
*CPU, RAM... donc on renvoie les metrics avec node exporter
|
||||||
|
|
||||||
|
et │ └── supervisord.conf # Mis à jour ?
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
centre_observabilite/loki-index/index_20445/1766491200
Normal file
BIN
centre_observabilite/loki-index/index_20445/1766491200
Normal file
Binary file not shown.
BIN
centre_observabilite/loki-index/index_20445/1766492100
Normal file
BIN
centre_observabilite/loki-index/index_20445/1766492100
Normal file
Binary file not shown.
BIN
centre_observabilite/loki-index/index_20445/1766492100.snapshot
Normal file
BIN
centre_observabilite/loki-index/index_20445/1766492100.snapshot
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
centre_observabilite/loki-wal/00000109
Normal file
BIN
centre_observabilite/loki-wal/00000109
Normal file
Binary file not shown.
BIN
centre_observabilite/loki-wal/00000110
Normal file
BIN
centre_observabilite/loki-wal/00000110
Normal file
Binary file not shown.
Binary file not shown.
BIN
centre_observabilite/loki-wal/checkpoint.000108/00000000
Normal file
BIN
centre_observabilite/loki-wal/checkpoint.000108/00000000
Normal file
Binary file not shown.
@ -1,14 +1,30 @@
|
|||||||
FROM debian:bullseye-slim
|
FROM debian:bullseye-slim
|
||||||
|
|
||||||
# Installation des dépendances
|
# Installation des dépendances de base
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
apache2 \
|
apache2 \
|
||||||
supervisor \
|
supervisor \
|
||||||
wget \
|
wget \
|
||||||
curl \
|
curl \
|
||||||
unzip \
|
unzip \
|
||||||
|
gnupg \
|
||||||
|
lsb-release \
|
||||||
|
openjdk-17-jdk \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Installation de Tomcat 10
|
||||||
|
RUN cd /opt && \
|
||||||
|
wget https://archive.apache.org/dist/tomcat/tomcat-10/v10.1.47/bin/apache-tomcat-10.1.47.tar.gz && \
|
||||||
|
tar -xzf apache-tomcat-10.1.47.tar.gz && \
|
||||||
|
mv apache-tomcat-10.1.47 tomcat && \
|
||||||
|
rm apache-tomcat-10.1.47.tar.gz && \
|
||||||
|
chmod +x /opt/tomcat/bin/*.sh
|
||||||
|
|
||||||
|
# Variables d'environnement Tomcat
|
||||||
|
ENV CATALINA_HOME=/opt/tomcat
|
||||||
|
ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
|
||||||
|
ENV PATH=$PATH:$CATALINA_HOME/bin
|
||||||
|
|
||||||
# Installation Apache Exporter
|
# Installation Apache Exporter
|
||||||
RUN wget https://github.com/Lusitaniae/apache_exporter/releases/download/v1.0.10/apache_exporter-1.0.10.linux-amd64.tar.gz \
|
RUN wget https://github.com/Lusitaniae/apache_exporter/releases/download/v1.0.10/apache_exporter-1.0.10.linux-amd64.tar.gz \
|
||||||
&& tar xzf apache_exporter-1.0.10.linux-amd64.tar.gz \
|
&& tar xzf apache_exporter-1.0.10.linux-amd64.tar.gz \
|
||||||
@ -39,11 +55,23 @@ RUN echo '<Location "/server-status">\n\
|
|||||||
Require all granted\n\
|
Require all granted\n\
|
||||||
</Location>' > /etc/apache2/conf-available/server-status.conf \
|
</Location>' > /etc/apache2/conf-available/server-status.conf \
|
||||||
&& a2enconf server-status \
|
&& a2enconf server-status \
|
||||||
&& a2enmod status
|
&& a2enmod status \
|
||||||
|
&& a2enmod proxy \
|
||||||
|
&& a2enmod proxy_http
|
||||||
|
|
||||||
|
# Configuration du proxy Apache vers Tomcat
|
||||||
|
RUN echo '<VirtualHost *:80>\n\
|
||||||
|
ProxyPreserveHost On\n\
|
||||||
|
ProxyPass /api http://localhost:8080/api\n\
|
||||||
|
ProxyPassReverse /api http://localhost:8080/api\n\
|
||||||
|
</VirtualHost>' > /etc/apache2/sites-available/000-default.conf
|
||||||
|
|
||||||
# Création des répertoires de logs
|
# Création des répertoires de logs
|
||||||
RUN mkdir -p /var/log/apache2 /var/log/promtail
|
RUN mkdir -p /var/log/apache2 /var/log/promtail /opt/tomcat/logs
|
||||||
|
|
||||||
EXPOSE 80 9100 9117 9080
|
# Copie du WAR (à placer dans le contexte de build)
|
||||||
|
COPY archiweb-api-1.0.0.war /opt/tomcat/webapps/api.war
|
||||||
|
|
||||||
|
EXPOSE 80 8080 9100 9117 9080
|
||||||
|
|
||||||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
|
||||||
|
|||||||
@ -14,7 +14,7 @@ scrape_configs:
|
|||||||
- targets: [localhost]
|
- targets: [localhost]
|
||||||
labels:
|
labels:
|
||||||
job: apache_access
|
job: apache_access
|
||||||
host: apache_all_in_one
|
host: archiweb_app
|
||||||
__path__: /var/log/apache2/access.log
|
__path__: /var/log/apache2/access.log
|
||||||
|
|
||||||
- job_name: apache_error
|
- job_name: apache_error
|
||||||
@ -22,5 +22,41 @@ scrape_configs:
|
|||||||
- targets: [localhost]
|
- targets: [localhost]
|
||||||
labels:
|
labels:
|
||||||
job: apache_error
|
job: apache_error
|
||||||
host: apache_all_in_one
|
host: archiweb_app
|
||||||
__path__: /var/log/apache2/error.log
|
__path__: /var/log/apache2/error.log
|
||||||
|
|
||||||
|
- job_name: tomcat_catalina
|
||||||
|
static_configs:
|
||||||
|
- targets: [localhost]
|
||||||
|
labels:
|
||||||
|
job: tomcat
|
||||||
|
host: archiweb_app
|
||||||
|
type: catalina
|
||||||
|
__path__: /opt/tomcat/logs/catalina*.log
|
||||||
|
|
||||||
|
- job_name: tomcat_localhost
|
||||||
|
static_configs:
|
||||||
|
- targets: [localhost]
|
||||||
|
labels:
|
||||||
|
job: tomcat
|
||||||
|
host: archiweb_app
|
||||||
|
type: localhost
|
||||||
|
__path__: /opt/tomcat/logs/localhost*.log
|
||||||
|
|
||||||
|
- job_name: tomcat_access
|
||||||
|
static_configs:
|
||||||
|
- targets: [localhost]
|
||||||
|
labels:
|
||||||
|
job: tomcat
|
||||||
|
host: archiweb_app
|
||||||
|
type: access
|
||||||
|
__path__: /opt/tomcat/logs/localhost_access_log*.txt
|
||||||
|
|
||||||
|
- job_name: tomcat_out
|
||||||
|
static_configs:
|
||||||
|
- targets: [localhost]
|
||||||
|
labels:
|
||||||
|
job: tomcat
|
||||||
|
host: archiweb_app
|
||||||
|
type: out
|
||||||
|
__path__: /opt/tomcat/logs/catalina.out
|
||||||
|
|||||||
111
conteneur/database/data.sql
Normal file
111
conteneur/database/data.sql
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
-- Ajout des rôles
|
||||||
|
INSERT INTO role (nom)
|
||||||
|
VALUES ('Administrateur'),
|
||||||
|
('Enseignant'),
|
||||||
|
('Étudiant');
|
||||||
|
|
||||||
|
-- Ajout des utilisateurs
|
||||||
|
INSERT INTO utilisateur (login, mot_de_passe, nom, prenom, email)
|
||||||
|
VALUES ('jlpicar', 'password', 'Picard', 'Jean-Luc', 'jean-luc.picard@starfleet.com'),
|
||||||
|
('kjaneway', 'password', 'Janeway', 'Kathryn', 'kathryn.janeway@starfleet.com'),
|
||||||
|
('spock', 'password', '', 'Spock', 'spock@starfleet.com'),
|
||||||
|
('wriker', 'password', 'Riker', 'William', 'william.riker@starfleet.com'),
|
||||||
|
('data', 'password', '', 'Data', 'data@starfleet.com'),
|
||||||
|
('glaforge', 'password', 'LaForge', 'Geordi', 'geordi.laforge@starfleet.com'),
|
||||||
|
('tuvok', 'password', 'Tuvok', '', 'tuvok@starfleet.com'),
|
||||||
|
('wcrusher', 'password', 'Crusher', 'Wesley', 'wesley.crusher@starfleet.com'),
|
||||||
|
('tparis', 'password', 'Paris', 'Tom', 'tom.paris@starfleet.com'),
|
||||||
|
('hkim', 'password', 'Kim', 'Harry', 'harry.kim@starfleet.com'),
|
||||||
|
('jsisko', 'password', 'Sisko', 'Jake', 'jake.sisko@starfleet.com'),
|
||||||
|
('nog', 'password', '', 'Nog', 'nog@starfleet.com'),
|
||||||
|
('bmariner', 'password', 'Mariner', 'Beckett', 'beckett.mariner@starfleet.com'),
|
||||||
|
('bboimler', 'password', 'Boimler', 'Brad', 'brad.boimler@starfleet.com'),
|
||||||
|
('dvtendi', 'password', 'Tendi', 'D''Vana', 'd-vana.tendi@starfleet.com'),
|
||||||
|
('srutherf', 'password', 'Rutherford', 'Sam', 'sam.rutherford@starfleet.com'),
|
||||||
|
('drel', 'password', 'R''El', 'Dal', 'dal.r-el@starfleet.com'),
|
||||||
|
('gwyndala', 'password', '', 'Gwyndala', 'gwyndala@starfleet.com'),
|
||||||
|
('roktahk', 'password', '', 'Rok-Tahk', 'rok-takh@starfleet.com'),
|
||||||
|
('zero', 'password', 'Zero', '', 'zero@starfleet.com'),
|
||||||
|
('jpog', 'password', 'Pog', 'Jankom', 'jankom.pog@starfleet.com'),
|
||||||
|
('murf', 'password', '', 'Murf', 'murf@starfleet.com');
|
||||||
|
|
||||||
|
-- Ajout des rôles aux utilisateurs
|
||||||
|
INSERT INTO utilisateur_role (utilisateur_id, role_id)
|
||||||
|
VALUES ((select id from utilisateur where login = 'jlpicar'), 1), -- Picard as Administrator
|
||||||
|
((select id from utilisateur where login = 'kjaneway'), 1), -- Janeway as Administrator
|
||||||
|
((select id from utilisateur where login = 'spock'), 2), -- Spock as Teacher
|
||||||
|
((select id from utilisateur where login = 'wriker'), 2), -- Riker as Teacher
|
||||||
|
((select id from utilisateur where login = 'data'), 2), -- Data as Teacher
|
||||||
|
((select id from utilisateur where login = 'glaforge'), 2), -- LaForge as Teacher
|
||||||
|
((select id from utilisateur where login = 'tuvok'), 2), -- Tuvok as Teacher
|
||||||
|
((select id from utilisateur where login = 'wcrusher'), 3), -- Crusher as Student
|
||||||
|
((select id from utilisateur where login = 'tparis'), 3), -- Paris as Student
|
||||||
|
((select id from utilisateur where login = 'hkim'), 3), -- Kim as Student
|
||||||
|
((select id from utilisateur where login = 'jsisko'), 3), -- Sisko as Student
|
||||||
|
((select id from utilisateur where login = 'nog'), 3), -- Nog as Student
|
||||||
|
((select id from utilisateur where login = 'bmariner'), 3), -- Mariner as Student
|
||||||
|
((select id from utilisateur where login = 'bboimler'), 3), -- Boimler as Student
|
||||||
|
((select id from utilisateur where login = 'dvtendi'), 3), -- Tendi as Student
|
||||||
|
((select id from utilisateur where login = 'srutherf'), 3), -- Rutherford as Student
|
||||||
|
((select id from utilisateur where login = 'drel'), 3), -- R'El as Student
|
||||||
|
((select id from utilisateur where login = 'gwyndala'), 3), -- Gwyndala as Student
|
||||||
|
((select id from utilisateur where login = 'roktahk'), 3), -- Rok-Tahk as Student
|
||||||
|
((select id from utilisateur where login = 'zero'), 3), -- Zero as Student
|
||||||
|
((select id from utilisateur where login = 'jpog'), 3), -- Pog as Student
|
||||||
|
((select id from utilisateur where login = 'murf'), 3);
|
||||||
|
-- Murf as Student
|
||||||
|
|
||||||
|
-- Ajout des cours
|
||||||
|
INSERT INTO cours (nom, date_debut)
|
||||||
|
VALUES ('Starship Command', '2023-01-01'),
|
||||||
|
('Warp Theory', '2023-02-01'),
|
||||||
|
('Federation Ethics', '2023-03-01');
|
||||||
|
|
||||||
|
-- Ajout des enseignements
|
||||||
|
INSERT INTO enseignement (utilisateur_id, cours_id)
|
||||||
|
VALUES ((select id from utilisateur where login = 'spock'), 1), -- Spock teaches Starship Command
|
||||||
|
((select id from utilisateur where login = 'wriker'), 1), -- Riker teaches Starship Command
|
||||||
|
((select id from utilisateur where login = 'data'), 2), -- Data teaches Warp Theory
|
||||||
|
((select id from utilisateur where login = 'glaforge'), 2), -- LaForge teaches Warp Theory
|
||||||
|
((select id from utilisateur where login = 'tuvok'), 3);
|
||||||
|
-- Tuvok teaches Federation Ethics
|
||||||
|
|
||||||
|
-- Ajout des inscriptions
|
||||||
|
INSERT INTO inscription (utilisateur_id, cours_id)
|
||||||
|
VALUES ((select id from utilisateur where login = 'wcrusher'), 1), -- Crusher enrolls in Starship Command
|
||||||
|
((select id from utilisateur where login = 'wcrusher'), 2), -- Crusher enrolls in Warp Theory
|
||||||
|
((select id from utilisateur where login = 'tparis'), 1), -- Paris enrolls in Starship Command
|
||||||
|
((select id from utilisateur where login = 'hkim'), 1), -- Kim enrolls in Starship Command
|
||||||
|
((select id from utilisateur where login = 'jsisko'), 3), -- Sisko enrolls in Federation Ethics
|
||||||
|
((select id from utilisateur where login = 'nog'), 1), -- Nog enrolls in Starship Command
|
||||||
|
((select id from utilisateur where login = 'nog'), 3), -- Nog enrolls in Federation Ethics
|
||||||
|
((select id from utilisateur where login = 'bboimler'), 1), -- Boimler enrolls in Starship Command
|
||||||
|
((select id from utilisateur where login = 'dvtendi'), 2), -- Tendi enrolls in Warp Theory
|
||||||
|
((select id from utilisateur where login = 'srutherf'), 2), -- Rutherford enrolls in Warp Theory
|
||||||
|
((select id from utilisateur where login = 'drel'), 1), -- R'El enrolls in Starship Command
|
||||||
|
((select id from utilisateur where login = 'gwyndala'), 1), -- Gwyndala enrolls in Starship Command
|
||||||
|
((select id from utilisateur where login = 'gwyndala'), 3), -- Gwyndala enrolls in Federation Ethics
|
||||||
|
((select id from utilisateur where login = 'roktahk'), 2), -- Rok-Tahk enrolls in Warp Theory
|
||||||
|
((select id from utilisateur where login = 'zero'), 3), -- Zero enrolls in Federation Ethics
|
||||||
|
((select id from utilisateur where login = 'jpog'), 2);
|
||||||
|
-- Pog enrolls in Warp Theory
|
||||||
|
|
||||||
|
-- Ajout des contenus de cours
|
||||||
|
INSERT INTO contenu_cours (cours_id, titre, description)
|
||||||
|
VALUES (1, 'Bridge Operations', 'Learn how to manage starship operations.'),
|
||||||
|
(1, 'Tactical Maneuvers', 'Advanced starship tactics.'),
|
||||||
|
(1, 'Command Decision Making', 'Develop leadership skills for commanding a starship.'),
|
||||||
|
(2, 'Warp Core Mechanics', 'Understand the inner workings of warp cores.'),
|
||||||
|
(2, 'Dilithium Crystals', 'Study the properties of dilithium crystals.'),
|
||||||
|
(2, 'Warp Field Theory', 'Explore the physics behind warp travel.'),
|
||||||
|
(3, 'Prime Directive', 'Ethical dilemmas in space exploration.'),
|
||||||
|
(3, 'Cultural Sensitivity', 'Learn how to interact with alien civilizations.'),
|
||||||
|
(3, 'Federation Law', 'Understand the legal framework of the Federation.');
|
||||||
|
|
||||||
|
-- Ajout des devoirs
|
||||||
|
INSERT INTO devoir (cours_id, titre, description, date_debut, date_fin)
|
||||||
|
VALUES (1, 'Bridge Simulation', 'Participate in a simulated bridge operation.', '2023-01-15', '2023-01-30'),
|
||||||
|
(1, 'Tactical Exercise', 'Plan and execute tactical maneuvers.', '2023-01-20', '2023-02-05'),
|
||||||
|
(2, 'Warp Core Analysis', 'Analyze the efficiency of a warp core.', '2023-02-10', '2023-02-25'),
|
||||||
|
(2, 'Crystal Experiment', 'Experiment with dilithium crystals.', '2023-02-15', '2023-03-01'),
|
||||||
|
(3, 'Prime Directive Case Study', 'Discuss ethical dilemmas.', '2023-03-10', '2023-03-25');
|
||||||
136
conteneur/database/schema.sql
Normal file
136
conteneur/database/schema.sql
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
-- Drop tables if they exist
|
||||||
|
DROP TABLE IF EXISTS note;
|
||||||
|
DROP TABLE IF EXISTS rendu_devoir;
|
||||||
|
DROP TABLE IF EXISTS devoir;
|
||||||
|
DROP TABLE IF EXISTS contenu_cours;
|
||||||
|
DROP TABLE IF EXISTS inscription;
|
||||||
|
DROP TABLE IF EXISTS enseignement;
|
||||||
|
DROP TABLE IF EXISTS cours;
|
||||||
|
DROP TABLE IF EXISTS utilisateur_role;
|
||||||
|
DROP TABLE IF EXISTS role;
|
||||||
|
DROP TABLE IF EXISTS utilisateur;
|
||||||
|
|
||||||
|
-- Table utilisateur : représente un utilisateur de l'application
|
||||||
|
CREATE TABLE utilisateur
|
||||||
|
(
|
||||||
|
id BIGSERIAL NOT NULL,
|
||||||
|
login VARCHAR(8) NOT NULL,
|
||||||
|
mot_de_passe VARCHAR(255) NOT NULL,
|
||||||
|
nom VARCHAR(100),
|
||||||
|
prenom VARCHAR(100),
|
||||||
|
email VARCHAR(255),
|
||||||
|
PRIMARY KEY (id),
|
||||||
|
CONSTRAINT ux_u_login UNIQUE (login),
|
||||||
|
CONSTRAINT ux_u_email UNIQUE (email)
|
||||||
|
);
|
||||||
|
CREATE INDEX ix_u_login ON utilisateur (login);
|
||||||
|
|
||||||
|
-- Table role : représente un rôle d'utilisateur
|
||||||
|
CREATE TABLE role
|
||||||
|
(
|
||||||
|
id BIGSERIAL NOT NULL,
|
||||||
|
nom VARCHAR(100) NOT NULL,
|
||||||
|
PRIMARY KEY (id),
|
||||||
|
CONSTRAINT ux_r_nom UNIQUE (nom)
|
||||||
|
);
|
||||||
|
CREATE INDEX ix_r_nom ON role (nom);
|
||||||
|
|
||||||
|
-- Table utilisateur_role : association entre utilisateurs et rôles
|
||||||
|
CREATE TABLE utilisateur_role
|
||||||
|
(
|
||||||
|
utilisateur_id BIGINT NOT NULL,
|
||||||
|
role_id BIGINT NOT NULL,
|
||||||
|
PRIMARY KEY (utilisateur_id, role_id),
|
||||||
|
CONSTRAINT fk_ur_utilisateur_id FOREIGN KEY (utilisateur_id) REFERENCES utilisateur (id) ON DELETE CASCADE,
|
||||||
|
CONSTRAINT fk_ur_role_id FOREIGN KEY (role_id) REFERENCES role (id) ON DELETE CASCADE
|
||||||
|
);
|
||||||
|
CREATE INDEX ix_ur_utilisateur_id ON utilisateur_role (utilisateur_id);
|
||||||
|
CREATE INDEX ix_ur_role_id ON utilisateur_role (role_id);
|
||||||
|
|
||||||
|
-- Table cours : représente un cours
|
||||||
|
CREATE TABLE cours
|
||||||
|
(
|
||||||
|
id BIGSERIAL NOT NULL,
|
||||||
|
nom VARCHAR(100) NOT NULL,
|
||||||
|
date_debut DATE NOT NULL,
|
||||||
|
PRIMARY KEY (id)
|
||||||
|
);
|
||||||
|
CREATE INDEX ix_c_nom ON cours (nom);
|
||||||
|
|
||||||
|
-- Table enseignement : association entre utilisateurs et cours
|
||||||
|
CREATE TABLE enseignement
|
||||||
|
(
|
||||||
|
utilisateur_id BIGINT NOT NULL,
|
||||||
|
cours_id BIGINT NOT NULL,
|
||||||
|
PRIMARY KEY (utilisateur_id, cours_id),
|
||||||
|
CONSTRAINT fk_e_utilisateur_id FOREIGN KEY (utilisateur_id) REFERENCES utilisateur (id) ON DELETE CASCADE,
|
||||||
|
CONSTRAINT fk_e_cours_id FOREIGN KEY (cours_id) REFERENCES cours (id) ON DELETE CASCADE
|
||||||
|
);
|
||||||
|
CREATE INDEX ix_e_utilisateur_id ON enseignement (utilisateur_id);
|
||||||
|
CREATE INDEX ix_e_cours_id ON enseignement (cours_id);
|
||||||
|
|
||||||
|
-- Table inscription : association entre utilisateurs et cours
|
||||||
|
CREATE TABLE inscription
|
||||||
|
(
|
||||||
|
utilisateur_id BIGINT NOT NULL,
|
||||||
|
cours_id BIGINT NOT NULL,
|
||||||
|
date_inscription TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
PRIMARY KEY (utilisateur_id, cours_id),
|
||||||
|
CONSTRAINT fk_i_utilisateur_id FOREIGN KEY (utilisateur_id) REFERENCES utilisateur (id) ON DELETE CASCADE,
|
||||||
|
CONSTRAINT fk_i_cours_id FOREIGN KEY (cours_id) REFERENCES cours (id) ON DELETE CASCADE
|
||||||
|
);
|
||||||
|
CREATE INDEX ix_i_utilisateur_id ON inscription (utilisateur_id);
|
||||||
|
CREATE INDEX ix_i_cours_id ON inscription (cours_id);
|
||||||
|
|
||||||
|
-- Table contenu_cours : représente le contenu d'un cours
|
||||||
|
CREATE TABLE contenu_cours
|
||||||
|
(
|
||||||
|
id BIGSERIAL NOT NULL,
|
||||||
|
cours_id BIGINT NOT NULL,
|
||||||
|
titre VARCHAR(255) NOT NULL,
|
||||||
|
description TEXT,
|
||||||
|
PRIMARY KEY (id),
|
||||||
|
CONSTRAINT fk_cc_cours_id FOREIGN KEY (cours_id) REFERENCES cours (id) ON DELETE CASCADE
|
||||||
|
);
|
||||||
|
CREATE INDEX ix_cc_cours_id ON contenu_cours (cours_id);
|
||||||
|
|
||||||
|
-- Table devoir : représente un devoir associé à un cours
|
||||||
|
CREATE TABLE devoir
|
||||||
|
(
|
||||||
|
id BIGSERIAL NOT NULL,
|
||||||
|
cours_id BIGINT NOT NULL,
|
||||||
|
titre VARCHAR(255) NOT NULL,
|
||||||
|
description TEXT,
|
||||||
|
date_debut TIMESTAMP NOT NULL,
|
||||||
|
date_fin TIMESTAMP NOT NULL,
|
||||||
|
PRIMARY KEY (id),
|
||||||
|
CONSTRAINT fk_d_cours_id FOREIGN KEY (cours_id) REFERENCES cours (id) ON DELETE CASCADE
|
||||||
|
);
|
||||||
|
CREATE INDEX ix_d_cours_id ON devoir (cours_id);
|
||||||
|
|
||||||
|
-- Table rendu_devoir : représente le rendu d'un devoir par un utilisateur
|
||||||
|
CREATE TABLE rendu_devoir
|
||||||
|
(
|
||||||
|
id BIGSERIAL NOT NULL,
|
||||||
|
devoir_id BIGINT NOT NULL,
|
||||||
|
utilisateur_id BIGINT NOT NULL,
|
||||||
|
date_rendu TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
contenu TEXT,
|
||||||
|
PRIMARY KEY (id),
|
||||||
|
CONSTRAINT fk_rd_devoir_id FOREIGN KEY (devoir_id) REFERENCES devoir (id) ON DELETE CASCADE,
|
||||||
|
CONSTRAINT fk_rd_utilisateur_id FOREIGN KEY (utilisateur_id) REFERENCES utilisateur (id) ON DELETE CASCADE
|
||||||
|
);
|
||||||
|
CREATE INDEX ix_rd_devoir_id ON rendu_devoir (devoir_id);
|
||||||
|
CREATE INDEX ix_rd_utilisateur_id ON rendu_devoir (utilisateur_id);
|
||||||
|
|
||||||
|
-- Table note : représente une note attribuée à un rendu de devoir
|
||||||
|
CREATE TABLE note
|
||||||
|
(
|
||||||
|
id BIGSERIAL NOT NULL,
|
||||||
|
rendu_devoir_id BIGINT NOT NULL,
|
||||||
|
valeur DECIMAL(5, 2) NOT NULL CHECK (valeur >= 0 AND valeur <= 20),
|
||||||
|
date_attribution TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
PRIMARY KEY (id),
|
||||||
|
CONSTRAINT fk_n_rendu_devoir_id FOREIGN KEY (rendu_devoir_id) REFERENCES rendu_devoir (id) ON DELETE CASCADE
|
||||||
|
);
|
||||||
|
CREATE INDEX ix_n_rendu_devoir_id ON note (rendu_devoir_id);
|
||||||
Loading…
x
Reference in New Issue
Block a user