Modif MLD + Modif Script BDD suivant les modification à faire

merged
Kevin MONTEIRO 1 year ago
parent 09dafc90c0
commit 983245ad0f

@ -11,6 +11,7 @@ entity "Athlète" as athlete {
poids poids
motDePasse motDePasse
dateNaissance dateNaissance
isCoach
} }
entity "Amitié" as friendship{ entity "Amitié" as friendship{
@ -28,11 +29,7 @@ entity "Notification" as notif {
#athleteId #athleteId
} }
entity "Coach" as coach {
{static} idCoach
// attributs spécifiques au coach
#athleteId
}
entity "Statistique" as stats { entity "Statistique" as stats {
{static} idStatistique {static} idStatistique
@ -52,7 +49,7 @@ entity "Entraînement" as training {
latitude latitude
longitude longitude
feedback feedback
#coachId #athleteId
} }
entity "Participe" as takepart { entity "Participe" as takepart {
@ -101,13 +98,12 @@ entity "FréquenceCardiaque" as fc {
activity --> athlete activity --> athlete
activity --> source activity --> source
activity <-- fc activity <-- fc
coach --> athlete
athlete <-- source athlete <-- source
stats --> athlete stats --> athlete
takepart --> athlete takepart --> athlete
takepart --> training takepart --> training
friendship --> athlete friendship --> athlete
notif --> athlete notif --> athlete
coach <-- training athlete <-- training
athlete <-- friendship athlete <-- friendship
@enduml @enduml

@ -1,6 +1,5 @@
-- Athlete Table CREATE OR REPLACE TABLE Athlete (
CREATE TABLE Athlete ( idAthlete INT AUTO_INCREMENT PRIMARY KEY,
idAthlete SERIAL PRIMARY KEY,
nom VARCHAR(255), nom VARCHAR(255),
prenom VARCHAR(255), prenom VARCHAR(255),
email VARCHAR(255) UNIQUE, email VARCHAR(255) UNIQUE,
@ -8,11 +7,11 @@ CREATE TABLE Athlete (
taille DECIMAL, taille DECIMAL,
poids DECIMAL, poids DECIMAL,
motDePasse VARCHAR(255), motDePasse VARCHAR(255),
dateNaissance DATE dateNaissance DATE,
isCoach BOOLEAN
); );
-- Friendship Table CREATE OR REPLACE TABLE Friendship (
CREATE TABLE Friendship (
idAthlete1 INT, idAthlete1 INT,
idAthlete2 INT, idAthlete2 INT,
debut DATE, debut DATE,
@ -21,9 +20,8 @@ CREATE TABLE Friendship (
FOREIGN KEY (idAthlete2) REFERENCES Athlete(idAthlete) FOREIGN KEY (idAthlete2) REFERENCES Athlete(idAthlete)
); );
-- Notification Table CREATE OR REPLACE TABLE Notification (
CREATE TABLE Notification ( idNotif INT AUTO_INCREMENT PRIMARY KEY,
idNotif SERIAL PRIMARY KEY,
message TEXT, message TEXT,
date DATE, date DATE,
statut BOOLEAN, statut BOOLEAN,
@ -32,16 +30,8 @@ CREATE TABLE Notification (
FOREIGN KEY (athleteId) REFERENCES Athlete(idAthlete) FOREIGN KEY (athleteId) REFERENCES Athlete(idAthlete)
); );
-- Coach Table CREATE OR REPLACE TABLE Statistique (
CREATE TABLE Coach ( idStatistique INT AUTO_INCREMENT PRIMARY KEY,
idCoach SERIAL PRIMARY KEY,
athleteId INT,
FOREIGN KEY (athleteId) REFERENCES Athlete (idAthlete)
);
-- Statistique Table
CREATE TABLE Statistique (
idStatistique SERIAL PRIMARY KEY,
poids DECIMAL, poids DECIMAL,
fcMoyenne DECIMAL, fcMoyenne DECIMAL,
fcMax DECIMAL, fcMax DECIMAL,
@ -51,20 +41,18 @@ CREATE TABLE Statistique (
FOREIGN KEY (athleteId) REFERENCES Athlete(idAthlete) FOREIGN KEY (athleteId) REFERENCES Athlete(idAthlete)
); );
-- Entrainement Table CREATE OR REPLACE TABLE Entrainement (
CREATE TABLE Entrainement ( idEntrainement INT AUTO_INCREMENT PRIMARY KEY,
idEntrainement SERIAL PRIMARY KEY,
date DATE, date DATE,
description TEXT, description TEXT,
latitude DECIMAL, latitude DECIMAL,
longitude DECIMAL, longitude DECIMAL,
feedback TEXT, feedback TEXT,
coachId INT, athleteId INT,
FOREIGN KEY (coachId) REFERENCES Coach (idCoach) FOREIGN KEY (athleteId) REFERENCES Athlete(idAthlete)
); );
-- Participe Table CREATE OR REPLACE TABLE Participe (
CREATE TABLE Participe (
athleteId INT, athleteId INT,
entrainementId INT, entrainementId INT,
PRIMARY KEY (athleteId, entrainementId), PRIMARY KEY (athleteId, entrainementId),
@ -72,19 +60,17 @@ CREATE TABLE Participe (
FOREIGN KEY (entrainementId) REFERENCES Entrainement(idEntrainement) FOREIGN KEY (entrainementId) REFERENCES Entrainement(idEntrainement)
); );
-- SourceDonnee Table CREATE OR REPLACE TABLE SourceDonnee (
CREATE TABLE SourceDonnee ( idSource INT AUTO_INCREMENT PRIMARY KEY,
idSource SERIAL PRIMARY KEY,
type VARCHAR(255), type VARCHAR(255),
modele VARCHAR(255), modele VARCHAR(255),
precision DECIMAL, precision2 DECIMAL,
athleteId INT, athleteId INT,
FOREIGN KEY (athleteId) REFERENCES Athlete(idAthlete) FOREIGN KEY (athleteId) REFERENCES Athlete(idAthlete)
); );
-- Activite Table CREATE OR REPLACE TABLE Activite (
CREATE TABLE Activite ( idActivite INT AUTO_INCREMENT PRIMARY KEY,
idActivite SERIAL PRIMARY KEY,
type VARCHAR(255), type VARCHAR(255),
date DATE, date DATE,
heureDeDebut TIME, heureDeDebut TIME,
@ -103,9 +89,8 @@ CREATE TABLE Activite (
FOREIGN KEY (sourceId) REFERENCES SourceDonnee(idSource) FOREIGN KEY (sourceId) REFERENCES SourceDonnee(idSource)
); );
-- FrequenceCardiaque Table CREATE OR REPLACE TABLE FrequenceCardiaque (
CREATE TABLE FrequenceCardiaque ( idFc INT AUTO_INCREMENT PRIMARY KEY,
idFc SERIAL PRIMARY KEY,
altitude DECIMAL, altitude DECIMAL,
temps TIME, temps TIME,
temperature DECIMAL, temperature DECIMAL,
@ -116,43 +101,31 @@ CREATE TABLE FrequenceCardiaque (
FOREIGN KEY (activiteId) REFERENCES Activite(idActivite) FOREIGN KEY (activiteId) REFERENCES Activite(idActivite)
); );
-- Insertion de données dans la table Athlete INSERT INTO Athlete (nom, prenom, email, sexe, taille, poids, motDePasse, dateNaissance, isCoach) VALUES
INSERT INTO Athlete (nom, prenom, email, sexe, taille, poids, motDePasse, dateNaissance) VALUES ('Doe', 'John', 'john.doe@example.com', 'M', 1.80, 70, 'password123', '1990-01-01', FALSE),
('Doe', 'John', 'john.doe@example.com', 'M', 1.80, 70, 'password123', '1990-01-01'), ('Smith', 'Jane', 'jane.smith@example.com', 'F', 1.65, 60, 'password456', '1992-02-02', TRUE);
('Smith', 'Jane', 'jane.smith@example.com', 'F', 1.65, 60, 'password456', '1992-02-02');
-- Insertion de données dans la table Friendship
INSERT INTO Friendship (idAthlete1, idAthlete2, debut) VALUES INSERT INTO Friendship (idAthlete1, idAthlete2, debut) VALUES
(1, 2, '2023-01-01'); (1, 2, '2023-01-01');
-- Insertion de données dans la table Notification
INSERT INTO Notification (message, date, statut, urgence, athleteId) VALUES INSERT INTO Notification (message, date, statut, urgence, athleteId) VALUES
('Training session at 10 AM', '2023-03-10', TRUE, 1, 1); ('Training session at 10 AM', '2023-03-10', TRUE, 1, 1);
-- Insertion de données dans la table Coach
INSERT INTO Coach (athleteId) VALUES
(1);
-- Insertion de données dans la table Statistique
INSERT INTO Statistique (poids, fcMoyenne, fcMax, caloriesBruleesMoy, date, athleteId) VALUES INSERT INTO Statistique (poids, fcMoyenne, fcMax, caloriesBruleesMoy, date, athleteId) VALUES
(70, 80, 150, 500, '2023-03-10', 1); (70, 80, 150, 500, '2023-03-10', 1);
-- Insertion de données dans la table Entrainement INSERT INTO Entrainement (date, description, latitude, longitude, feedback, athleteId) VALUES
INSERT INTO Entrainement (date, description, latitude, longitude, feedback, coachId) VALUES
('2023-03-12', 'Long run in the park', 40.7128, -74.0060, 'Good effort', 1); ('2023-03-12', 'Long run in the park', 40.7128, -74.0060, 'Good effort', 1);
-- Insertion de données dans la table Participe
INSERT INTO Participe (athleteId, entrainementId) VALUES INSERT INTO Participe (athleteId, entrainementId) VALUES
(1, 1); (1, 1);
-- Insertion de données dans la table SourceDonnee INSERT INTO SourceDonnee (type, modele, precision2, athleteId) VALUES
INSERT INTO SourceDonnee (type, modele, precision, athleteId) VALUES
('Heart Rate Monitor', 'HRM-Pro', 98.5, 1); ('Heart Rate Monitor', 'HRM-Pro', 98.5, 1);
-- Insertion de données dans la table Activite
INSERT INTO Activite (type, date, heureDeDebut, heureDeFin, effortRessent, variabilite, variance, ecartType, moyenne, maximum, minimum, temperatureMoyenne, athleteId, sourceId) VALUES INSERT INTO Activite (type, date, heureDeDebut, heureDeFin, effortRessent, variabilite, variance, ecartType, moyenne, maximum, minimum, temperatureMoyenne, athleteId, sourceId) VALUES
('Running', '2023-03-10', '08:00:00', '09:00:00', 7, 0.5, 1, 0.1, 140, 160, 120, 20, 1, 1); ('Running', '2023-03-10', '08:00:00', '09:00:00', 7, 0.5, 1, 0.1, 140, 160, 120, 20, 1, 1);
-- Insertion de données dans la table FrequenceCardiaque
INSERT INTO FrequenceCardiaque (altitude, temps, temperature, bpm, longitude, latitude, activiteId) VALUES INSERT INTO FrequenceCardiaque (altitude, temps, temperature, bpm, longitude, latitude, activiteId) VALUES
(100, '08:15:00', 15, 130, -74.0060, 40.7128, 1); (100, '08:15:00', 15, 130, -74.0060, 40.7128, 1);
Loading…
Cancel
Save