1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
| CREATE TABLE `Client` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`Nom` varchar(150) NOT NULL,
`Prenom` varchar(150) NOT NULL,
`Sexe` tinyint(4) NOT NULL,
`Naissance` date NOT NULL,
`AdrRue` varchar(150) DEFAULT NULL,
`AdrNoPost` int(11) DEFAULT NULL,
`Canton` varchar(150) DEFAULT NULL,
`TelPriv` varchar(150) DEFAULT NULL,
`TelProf` varchar(150) DEFAULT NULL,
`Email` varchar(150) DEFAULT NULL,
`DetenteurNo` int(11) DEFAULT NULL,
`DetenteurDate` date DEFAULT NULL,
`PermisNo` int(11) DEFAULT NULL,
`PermisDate` date DEFAULT NULL,
`Commentaire` varchar(150) DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `ClientCours` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`Cours_ID` int(11) NOT NULL,
`Client_ID` int(11) NOT NULL,
`Reussi` tinyint(1) DEFAULT '0',
`Modifie` tinyint(1) DEFAULT '0',
`DateInscription` date DEFAULT NULL,
PRIMARY KEY (`ID`),
KEY `fk_ClientCours_1` (`Client_ID`),
KEY `fk_ClientCours_2` (`Cours_ID`),
CONSTRAINT `fk_ClientCours_1` FOREIGN KEY (`Client_ID`) REFERENCES `Client` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `fk_ClientCours_2` FOREIGN KEY (`Cours_ID`) REFERENCES `Cours` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Cours` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`Moniteur_ID` int(11) DEFAULT NULL,
`Nom` text NOT NULL,
`DateDebut` date NOT NULL,
`DateFin` date NOT NULL,
`NbMax` int(11) NOT NULL,
`Prix` decimal(10,0) DEFAULT NULL,
`Annule` int(11) DEFAULT NULL COMMENT 'Si le cours n''a pas été annulé, valeur NULL (defaut).\n\nSi le cours a été annulé : id de l''utilisateur qui a annulé',
PRIMARY KEY (`ID`),
KEY `fk_Cours_1` (`Moniteur_ID`),
KEY `fk_Cours_2` (`Moniteur_ID`),
CONSTRAINT `fk_Cours_2` FOREIGN KEY (`Moniteur_ID`) REFERENCES `Utilisateur` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION,
CONSTRAINT `fk_Cours_1` FOREIGN KEY (`Moniteur_ID`) REFERENCES `Moniteur` (`ID`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
DROP TABLE IF EXISTS `Moniteur`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Moniteur` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`Nom` varchar(45) NOT NULL,
`Prenom` varchar(45) DEFAULT NULL,
`Telephone` varchar(45) DEFAULT NULL,
`Mobile` varchar(45) DEFAULT NULL,
`AdresseRue` varchar(255) DEFAULT NULL,
`AdresseCP` int(11) DEFAULT NULL,
`AdresseVille` varchar(45) DEFAULT NULL,
`AdressePays` varchar(45) DEFAULT NULL,
`Email` varchar(45) DEFAULT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='Table des moniteurs';
/*!40101 SET character_set_client = @saved_cs_client */;
CREATE TABLE `Session` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`Cours_ID` int(11) DEFAULT NULL,
`Moniteur_ID` int(11) DEFAULT NULL,
`DateDebut` datetime NOT NULL,
`DateFin` datetime NOT NULL,
`Lieu` text NOT NULL,
PRIMARY KEY (`ID`),
KEY `fk_Session_1` (`Cours_ID`),
CONSTRAINT `fk_Session_1` FOREIGN KEY (`Cours_ID`) REFERENCES `Cours` (`ID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `Utilisateur` (
`ID` int(11) NOT NULL AUTO_INCREMENT,
`Username` varchar(45) NOT NULL,
`Password` varchar(45) NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */; |
Partager