This commit is contained in:
Sébastien Marro 2020-12-04 03:05:48 +01:00
commit e2f14b7211
6 changed files with 113 additions and 129 deletions

View File

@ -7,4 +7,12 @@ class Hystorique
private Utilisateur $utilisateur; private Utilisateur $utilisateur;
private Spot $spot; private Spot $spot;
private Pointage $pointage; private Pointage $pointage;
public function __construct(int $id, Utilisateur $utilisateur, Spot $spot, Pointage $pointage)
{
$this->id=$id;
$this->utilisateur=$utilisateur;
$this->spot=$spot;
$this->pointage=$pointage;
}
} }

View File

@ -6,4 +6,12 @@ class Joueur
private int $id; private int $id;
private bool $estVivant; private bool $estVivant;
private bool $estImposteur; private bool $estImposteur;
public function __construct(int $id,bool $estVivant,bool $estImposteur)
{
$this->id=$id;
$this->estVivant=$estVivant;
$this->estImposteur=$estImposteur;
}
} }

View File

@ -7,4 +7,12 @@ class MeteoSpot
private int $houle; private int $houle;
private int $maree; private int $maree;
private int $vent; private int $vent;
public function __construct(int $id,int $houle,int $maree,int $vent)
{
$this->id=$id;
$this->houle=$houle;
$this->mare=$maree;
$this->vent=$vent;
}
} }

View File

@ -6,4 +6,12 @@ class MeteoVille
private int $id; private int $id;
private int $temperature; private int $temperature;
private int $vent; private int $vent;
public function __construct(int $id,int $temperature,int $vent)
{
$this->id=$id;
$this->temperature=$temperature;
$this->vent=$vent;
}
} }

View File

@ -11,4 +11,17 @@ class Pointage
private int $bateauVoile; private int $bateauVoile;
private Produits $produit; private Produits $produit;
private int $niveauDechet; private int $niveauDechet;
public function __construct(int $id,int $nbBaigneur,int $nbPratiquant,int $bateauPeche, int $bateauLoisir,int $bateauVoile, Produits $produit,int $niveauDechet)
{
$this->id=$id;
$this->nbBaigneur=$nbBaigneur;
$this->nbPratiquant=$nbPratiquant;
$this->bateauPeche=$bateauPeche;
$this->bateauLoisir=$bateauLoisir;
$this->bateauVoile=$bateauVoile;
$this->produit=$produit;
$this->niveauDechet=$niveauDechet;
}
} }

View File

@ -1,89 +1,36 @@
-- Create a new database called 'bddsurf'
-- Connect to the 'master' database to run this snippet
USE master
GO
-- Create the new database if it does not exist already
IF NOT EXISTS (
SELECT name
FROM sys.databases
WHERE name = N'bddsurf'
)
CREATE DATABASE bddsurf CREATE DATABASE bddsurf
GO
-- Create a new table called 'joueur' in schema 'bddsurf' CREATE TABLE joueur
-- Drop the table if it already exists
IF OBJECT_ID('bddsurf.joueur', 'U') IS NOT NULL
DROP TABLE bddsurf.joueur
GO
-- Create the table in the specified schema
CREATE TABLE bddsurf.joueur
( (
idJoueur INT NOT NULL PRIMARY KEY, -- primary key column idJoueur INT PRIMARY KEY NOT NULL AUTO_INCREMENT, -- primary key column
estVivant TINYINT, estVivant TINYINT,
estImposteur TINYINT estImposteur TINYINT
-- specify more columns here
); );
GO CREATE TABLE utilisateur
-- Create a new table called 'UTILISATEUR' in schema 'bddsurf'
-- Drop the table if it already exists
IF OBJECT_ID('bddsurf.utilisateur', 'U') IS NOT NULL
DROP TABLE bddsurf.utilisateur
GO
-- Create the table in the specified schema
CREATE TABLE bddsurf.utilisateur
( (
idUtilisateur INT NOT NULL PRIMARY KEY, -- primary key column idUtilisateur INT PRIMARY KEY NOT NULL AUTO_INCREMENT, -- primary key column
nomUtilisateur VARCHAR, nomUtilisateur VARCHAR(50),
prenomUtilisateur VARCHAR, prenomUtilisateur VARCHAR(50),
mailUtilisateur VARCHAR, mailUtilisateur VARCHAR(50),
pseudoUtilisateur VARCHAR, pseudoUtilisateur VARCHAR(50),
passwordUtilisateur VARCHAR passwordUtilisateur VARCHAR(50)
-- specify more columns here
); );
GO CREATE TABLE meteoville
-- Create a new table called 'meteoville' in schema 'bddsurf'
-- Drop the table if it already exists
IF OBJECT_ID('bddsurf.meteoville', 'U') IS NOT NULL
DROP TABLE bddsurf.meteoville
GO
-- Create the table in the specified schema
CREATE TABLE bddsurf.meteoville
( (
IdMeteoVille INT NOT NULL PRIMARY KEY, -- primary key column IdMeteoVille INT PRIMARY KEY NOT NULL AUTO_INCREMENT, -- primary key column
temperatureMeteoVille INT, temperatureMeteoVille INT,
ventMeteoVille INT ventMeteoVille INT
-- specify more columns here
); );
GO CREATE TABLE meteoSpot
-- Create a new table called 'meteoSpot' in schema 'bddsurf'
-- Drop the table if it already exists
IF OBJECT_ID('bddsurf.meteoSpot', 'U') IS NOT NULL
DROP TABLE bddsurf.meteoSpot
GO
-- Create the table in the specified schema
CREATE TABLE bddsurf.meteoSpot
( (
idMeteoSpot INT NOT NULL PRIMARY KEY, -- primary key column idMeteoSpot INT PRIMARY KEY NOT NULL AUTO_INCREMENT, -- primary key column
houleMeteoSpot INT, houleMeteoSpot INT,
mareeMeteoSpot INT, mareeMeteoSpot INT,
ventMeteoSpot INT ventMeteoSpot INT
-- specify more columns here
); );
GO CREATE TABLE produits
-- Create a new table called 'produits' in schema 'bddsurf'
-- Drop the table if it already exists
IF OBJECT_ID('bddsurf.produits', 'U') IS NOT NULL
DROP TABLE bddsurf.produits
GO
-- Create the table in the specified schema
CREATE TABLE bddsurf.produits
( (
idProduits INT NOT NULL PRIMARY KEY, -- primary key column idProduits INT PRIMARY KEY NOT NULL AUTO_INCREMENT, -- primary key column
estCremeSolaire TINYINT, estCremeSolaire TINYINT,
estParfum TINYINT, estParfum TINYINT,
estCremeHydratante TINYINT, estCremeHydratante TINYINT,
@ -92,80 +39,72 @@ CREATE TABLE bddsurf.produits
estCigarette TINYINT, estCigarette TINYINT,
estEngrais TINYINT, estEngrais TINYINT,
estPeinture TINYINT, estPeinture TINYINT,
AutreProduit VARCHAR AutreProduit VARCHAR(50)
-- specify more columns here
); );
GO CREATE TABLE pollution
-- Create a new table called 'ville' in schema 'bddsurf'
-- Drop the table if it already exists
IF OBJECT_ID('bddsurf.ville', 'U') IS NOT NULL
DROP TABLE bddsurf.ville
GO
-- Create the table in the specified schema
CREATE TABLE bddsurf.ville
( (
idVille INT NOT NULL PRIMARY KEY, -- primary key column idPollution INT PRIMARY KEY NOT NULL AUTO_INCREMENT, -- primary key column
nomVille VARCHAR, niveauPollution INT,
cpVille VARCHAR, descriptionPollution VARCHAR(50)
);
CREATE TABLE ville
(
idVille INT PRIMARY KEY NOT NULL AUTO_INCREMENT, -- primary key column
nomVille VARCHAR(50),
cpVille VARCHAR(50),
meteoVille INT NOT NULL, meteoVille INT NOT NULL,
CONSTRAINT fk_meteoville CONSTRAINT fk_meteoville
FOREIGN KEY (meteoVille) FOREIGN KEY (meteoVille)
REFERENCES bddsurf.meteoville(IdMeteoVille) REFERENCES meteoville(IdMeteoVille)
-- specify more columns here
); );
GO CREATE TABLE pointage
-- Create a new table called 'historique' in schema 'bddsurf'
-- Drop the table if it already exists
IF OBJECT_ID('bddsurf.historique', 'U') IS NOT NULL
DROP TABLE bddsurf.historique
GO
-- Create the table in the specified schema
CREATE TABLE bddsurf.historique
( (
idHistorique INT NOT NULL PRIMARY KEY, -- primary key column idPointage INT PRIMARY KEY NOT NULL AUTO_INCREMENT, -- primary key column
nbBaigneur INT,
nbPratiquant INT,
nbBateauPeche INT,
nbBateauLoisir INT,
nbBateauVoile INT,
produits INT NOT NULL,
niveauDechet INT,
CONSTRAINT fk_produitsPointage
FOREIGN KEY (produits)
REFERENCES produits(idProduits)
);
CREATE TABLE spot
(
idSpot INT PRIMARY KEY NOT NULL AUTO_INCREMENT, -- primary key column
nomSpot VARCHAR(50),
villeSpot INT NOT NULL,
meteoSpot INT NOT NULL,
pollutionSpot INT NOT NULL,
CONSTRAINT fk_villeSpot
FOREIGN KEY (villeSpot)
REFERENCES ville(idVille),
CONSTRAINT fk_meteoSpot
FOREIGN KEY (meteoSpot)
REFERENCES meteoSpot(idMeteoSpot),
CONSTRAINT fk_pollutionSpot
FOREIGN KEY (pollutionSpot)
REFERENCES pollution(idPollution)
);
CREATE TABLE historique
(
idHistorique INT PRIMARY KEY NOT NULL AUTO_INCREMENT, -- primary key column
utilisateur INT NOT NULL, utilisateur INT NOT NULL,
spot INT NOT NULL, spot INT NOT NULL,
pointage INT NOT NULL, pointage INT NOT NULL,
CONSTRAINT fk_user CONSTRAINT fk_user
FOREIGN KEY (utilisateur) FOREIGN KEY (utilisateur)
REFERENCES bddsurf.utilisateur(idUtilisateur) REFERENCES utilisateur(idUtilisateur),
-- specify more columns here CONSTRAINT fk_spot
FOREIGN KEY (spot)
REFERENCES spot(idSpot),
CONSTRAINT fk_pointage
FOREIGN KEY (pointage)
REFERENCES pointage(idPointage)
); );
GO
-- Create a new table called 'pollution' in schema 'bddsurf'
-- Drop the table if it already exists
IF OBJECT_ID('bddsurf.pollution', 'U') IS NOT NULL
DROP TABLE bddsurf.pollution
GO
-- Create the table in the specified schema
CREATE TABLE bddsurf.pollution
(
idPollution INT NOT NULL PRIMARY KEY, -- primary key column
niveauPollution INT,
descriptionPollution VARCHAR
-- specify more columns here
);
GO
-- Create a new table called 'spot' in schema 'bddsurf'
-- Drop the table if it already exists
IF OBJECT_ID('bddsurf.spot', 'U') IS NOT NULL
DROP TABLE bddsurf.spot
GO
-- Create the table in the specified schema
CREATE TABLE bddsurf.spot
(
idSpot INT NOT NULL PRIMARY KEY, -- primary key column
nomSpot VARCHAR,
villeSpot INT NOT NULL,
meteoSpot INT NOT NULL,
pollutionSpot INT NOT NULL
-- specify more columns here
);
GO