Commit 5bb4126c authored by raphael.peim's avatar raphael.peim

Edit createDB.sql

parent b409ddff
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
-- https://www.phpmyadmin.net/ -- https://www.phpmyadmin.net/
-- --
-- Hôte : localhost:8889 -- Hôte : localhost:8889
-- Généré le : jeu. 03 déc. 2020 à 22:19 -- Généré le : jeudi. 03 déc. 2020 à 14:20
-- Version du serveur : 5.7.26 -- Version du serveur : 5.7.26
-- Version de PHP : 7.4.2 -- Version de PHP : 7.4.2
...@@ -17,44 +17,52 @@ SET time_zone = "+00:00"; ...@@ -17,44 +17,52 @@ SET time_zone = "+00:00";
-- -------------------------------------------------------- -- --------------------------------------------------------
-- --
-- Structure de la table `game` -- Structure de la table `games`
-- --
CREATE TABLE `game` ( CREATE TABLE IF NOT EXISTS `games` (
`id` int(11) NOT NULL, `id` int(11) NOT NULL,
`private` tinyint(1) NOT NULL `private` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
-- --
-- Déchargement des données de la table `game` -- Structure de la table `messages`
-- --
INSERT INTO `game` (`id`, `private`) VALUES CREATE TABLE IF NOT EXISTS `messages` (
(1, 0), `id` int(11) NOT NULL,
(2, 1); `id_user` int(11) NOT NULL,
`id_user_private` int(11) NOT NULL,
`content` varchar(250) NOT NULL,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- -------------------------------------------------------- -- --------------------------------------------------------
-- --
-- Structure de la table `tournament` -- Structure de la table `sessions`
-- --
CREATE TABLE `tournament` ( CREATE TABLE IF NOT EXISTS `sessions` (
`id` int(11) NOT NULL, `id` int(11) NOT NULL,
`id_game` int(11) NOT NULL,
`id_user` int(11) NOT NULL, `id_user` int(11) NOT NULL,
`score` int(11) NOT NULL `date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
-- --
-- Déchargement des données de la table `tournament` -- Structure de la table `tournaments`
-- --
INSERT INTO `tournament` (`id`, `id_game`, `id_user`, `score`) VALUES CREATE TABLE IF NOT EXISTS `tournaments` (
(1, 1, 1, 1250), `id` int(11) NOT NULL,
(2, 1, 2, 1000), `id_game` int(11) NOT NULL,
(3, 1, 4, 1200), `id_user` int(11) NOT NULL,
(4, 1, 3, 1000); `score` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- -------------------------------------------------------- -- --------------------------------------------------------
...@@ -62,11 +70,13 @@ INSERT INTO `tournament` (`id`, `id_game`, `id_user`, `score`) VALUES ...@@ -62,11 +70,13 @@ INSERT INTO `tournament` (`id`, `id_game`, `id_user`, `score`) VALUES
-- Structure de la table `users` -- Structure de la table `users`
-- --
CREATE TABLE `users` ( CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) NOT NULL, `id` int(11) NOT NULL,
`firstname` varchar(50) NOT NULL, `firstname` varchar(50) NOT NULL,
`lastname` varchar(50) NOT NULL, `lastname` varchar(50) NOT NULL,
`login` varchar(50) NOT NULL, `login` varchar(50) NOT NULL,
`avatar` int(11) NOT NULL DEFAULT '1',
`avatar_url` varchar(255) NOT NULL DEFAULT '',
`email` varchar(255) NOT NULL, `email` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL, `password` varchar(255) NOT NULL,
`role` smallint(6) NOT NULL `role` smallint(6) NOT NULL
...@@ -76,28 +86,42 @@ CREATE TABLE `users` ( ...@@ -76,28 +86,42 @@ CREATE TABLE `users` (
-- Déchargement des données de la table `users` -- Déchargement des données de la table `users`
-- --
INSERT INTO `users` (`id`, `firstname`, `lastname`, `login`, `email`, `password`, `role`) VALUES INSERT INTO `users` (`id`, `firstname`, `lastname`, `login`, `avatar`, `avatar_url`, `email`, `password`, `role`) VALUES
(1, 'Raphaël', 'Peim', 'Raph', 'rp@gmail.com', '$2a$10$y9e4QV2mGc.j2l81n82KbOpDJB2m9O564pEOwLj58TsztFn6Fg552', 1), (1, 'Raphaël', 'Peim', 'Raph', 1, '', 'rp@gmail.com', '$2a$10$y9e4QV2mGc.j2l81n82KbOpDJB2m9O564pEOwLj58TsztFn6Fg552', 1),
(2, 'John', 'Doe', 'John', 'jd@etu.imt-lille-douai.fr', '$2a$10$EsNS5onYP0YacQR6Kpbgqu1r1nPXM3ag/dNVhD.Ui3eSJZkgkhYau', 0), (2, 'John', 'Doe', 'John', 1, '', 'jd@etu.imt-lille-douai.fr', '$2a$10$EsNS5onYP0YacQR6Kpbgqu1r1nPXM3ag/dNVhD.Ui3eSJZkgkhYau', 0),
(3, 'Nolwenn', 'Le Gourierec', 'Nono', 'nlg@etu.imt-lille-douai.fr', '$2a$10$EsNS5onYP0YacQR6Kpbgqu1r1nPXM3ag/dNVhD.Ui3eSJZkgkhYau', 0), (3, 'Admin', 'Admin', 'Admin', 1, '', 'admin@admin.com', '$2a$10$y9e4QV2mGc.j2l81n82KbOpDJB2m9O564pEOwLj58TsztFn6Fg552', 1);
(4, 'Romain', 'Benaya', 'Romich', 'rb@etu.imt-lille-douai.fr', '$2a$10$EsNS5onYP0YacQR6Kpbgqu1r1nPXM3ag/dNVhD.Ui3eSJZkgkhYau', 0);
-- --
-- Index pour les tables déchargées -- Index pour les tables déchargées
-- --
-- --
-- Index pour la table `game` -- Index pour la table `games`
-- --
ALTER TABLE `game` ALTER TABLE `games`
ADD PRIMARY KEY (`id`); ADD PRIMARY KEY (`id`);
-- --
-- Index pour la table `tournament` -- Index pour la table `messages`
-- --
ALTER TABLE `tournament` ALTER TABLE `messages`
ADD PRIMARY KEY (`id`), ADD PRIMARY KEY (`id`),
ADD KEY `id_game` (`id_game`,`id_user`), ADD KEY `id_user` (`id_user`),
ADD KEY `id_user_private` (`id_user_private`);
--
-- Index pour la table `sessions`
--
ALTER TABLE `sessions`
ADD PRIMARY KEY (`id`),
ADD KEY `id_user` (`id_user`);
--
-- Index pour la table `tournaments`
--
ALTER TABLE `tournaments`
ADD PRIMARY KEY (`id`),
ADD KEY `id_game` (`id_game`),
ADD KEY `id_user` (`id_user`); ADD KEY `id_user` (`id_user`);
-- --
...@@ -113,30 +137,43 @@ ALTER TABLE `users` ...@@ -113,30 +137,43 @@ ALTER TABLE `users`
-- --
-- --
-- AUTO_INCREMENT pour la table `game` -- AUTO_INCREMENT pour la table `games`
-- --
ALTER TABLE `game` ALTER TABLE `games`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
-- --
-- AUTO_INCREMENT pour la table `tournament` -- AUTO_INCREMENT pour la table `tournaments`
-- --
ALTER TABLE `tournament` ALTER TABLE `tournaments`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
-- --
-- AUTO_INCREMENT pour la table `users` -- AUTO_INCREMENT pour la table `users`
-- --
ALTER TABLE `users` ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9; MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
-- --
-- Contraintes pour les tables déchargées -- Contraintes pour les tables déchargées
-- --
-- --
-- Contraintes pour la table `tournament` -- Contraintes pour la table `messages`
--
ALTER TABLE `messages`
ADD CONSTRAINT `messages_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `messages_ibfk_2` FOREIGN KEY (`id_user_private`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Contraintes pour la table `sessions`
--
ALTER TABLE `sessions`
ADD CONSTRAINT `sessions_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Contraintes pour la table `tournaments`
-- --
ALTER TABLE `tournament` ALTER TABLE `tournaments`
ADD CONSTRAINT `tournament_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `tournaments_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `tournament_ibfk_2` FOREIGN KEY (`id_game`) REFERENCES `game` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; ADD CONSTRAINT `tournaments_ibfk_2` FOREIGN KEY (`id_game`) REFERENCES `games` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
-- https://www.phpmyadmin.net/ -- https://www.phpmyadmin.net/
-- --
-- Hôte : localhost:8889 -- Hôte : localhost:8889
-- Généré le : jeu. 03 déc. 2020 à 22:19 -- Généré le : jeudi. 03 déc. 2020 à 14:20
-- Version du serveur : 5.7.26 -- Version du serveur : 5.7.26
-- Version de PHP : 7.4.2 -- Version de PHP : 7.4.2
...@@ -17,44 +17,52 @@ SET time_zone = "+00:00"; ...@@ -17,44 +17,52 @@ SET time_zone = "+00:00";
-- -------------------------------------------------------- -- --------------------------------------------------------
-- --
-- Structure de la table `game` -- Structure de la table `games`
-- --
CREATE TABLE `game` ( CREATE TABLE IF NOT EXISTS `games` (
`id` int(11) NOT NULL, `id` int(11) NOT NULL,
`private` tinyint(1) NOT NULL `private` tinyint(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
-- --
-- Déchargement des données de la table `game` -- Structure de la table `messages`
-- --
INSERT INTO `game` (`id`, `private`) VALUES CREATE TABLE IF NOT EXISTS `messages` (
(1, 0), `id` int(11) NOT NULL,
(2, 1); `id_user` int(11) NOT NULL,
`id_user_private` int(11) NOT NULL,
`content` varchar(250) NOT NULL,
`date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- -------------------------------------------------------- -- --------------------------------------------------------
-- --
-- Structure de la table `tournament` -- Structure de la table `sessions`
-- --
CREATE TABLE `tournament` ( CREATE TABLE IF NOT EXISTS `sessions` (
`id` int(11) NOT NULL, `id` int(11) NOT NULL,
`id_game` int(11) NOT NULL,
`id_user` int(11) NOT NULL, `id_user` int(11) NOT NULL,
`score` int(11) NOT NULL `date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
-- --
-- Déchargement des données de la table `tournament` -- Structure de la table `tournaments`
-- --
INSERT INTO `tournament` (`id`, `id_game`, `id_user`, `score`) VALUES CREATE TABLE IF NOT EXISTS `tournaments` (
(1, 1, 1, 1250), `id` int(11) NOT NULL,
(2, 1, 2, 1000), `id_game` int(11) NOT NULL,
(3, 1, 4, 1200), `id_user` int(11) NOT NULL,
(4, 1, 3, 1000); `score` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- -------------------------------------------------------- -- --------------------------------------------------------
...@@ -62,11 +70,13 @@ INSERT INTO `tournament` (`id`, `id_game`, `id_user`, `score`) VALUES ...@@ -62,11 +70,13 @@ INSERT INTO `tournament` (`id`, `id_game`, `id_user`, `score`) VALUES
-- Structure de la table `users` -- Structure de la table `users`
-- --
CREATE TABLE `users` ( CREATE TABLE IF NOT EXISTS `users` (
`id` int(11) NOT NULL, `id` int(11) NOT NULL,
`firstname` varchar(50) NOT NULL, `firstname` varchar(50) NOT NULL,
`lastname` varchar(50) NOT NULL, `lastname` varchar(50) NOT NULL,
`login` varchar(50) NOT NULL, `login` varchar(50) NOT NULL,
`avatar` int(11) NOT NULL DEFAULT '1',
`avatar_url` varchar(255) NOT NULL DEFAULT '',
`email` varchar(255) NOT NULL, `email` varchar(255) NOT NULL,
`password` varchar(255) NOT NULL, `password` varchar(255) NOT NULL,
`role` smallint(6) NOT NULL `role` smallint(6) NOT NULL
...@@ -76,28 +86,42 @@ CREATE TABLE `users` ( ...@@ -76,28 +86,42 @@ CREATE TABLE `users` (
-- Déchargement des données de la table `users` -- Déchargement des données de la table `users`
-- --
INSERT INTO `users` (`id`, `firstname`, `lastname`, `login`, `email`, `password`, `role`) VALUES INSERT INTO `users` (`id`, `firstname`, `lastname`, `login`, `avatar`, `avatar_url`, `email`, `password`, `role`) VALUES
(1, 'Raphaël', 'Peim', 'Raph', 'rp@gmail.com', '$2a$10$y9e4QV2mGc.j2l81n82KbOpDJB2m9O564pEOwLj58TsztFn6Fg552', 1), (1, 'Raphaël', 'Peim', 'Raph', 1, '', 'rp@gmail.com', '$2a$10$y9e4QV2mGc.j2l81n82KbOpDJB2m9O564pEOwLj58TsztFn6Fg552', 1),
(2, 'John', 'Doe', 'John', 'jd@etu.imt-lille-douai.fr', '$2a$10$EsNS5onYP0YacQR6Kpbgqu1r1nPXM3ag/dNVhD.Ui3eSJZkgkhYau', 0), (2, 'John', 'Doe', 'John', 1, '', 'jd@etu.imt-lille-douai.fr', '$2a$10$EsNS5onYP0YacQR6Kpbgqu1r1nPXM3ag/dNVhD.Ui3eSJZkgkhYau', 0),
(3, 'Nolwenn', 'Le Gourierec', 'Nono', 'nlg@etu.imt-lille-douai.fr', '$2a$10$EsNS5onYP0YacQR6Kpbgqu1r1nPXM3ag/dNVhD.Ui3eSJZkgkhYau', 0), (3, 'Admin', 'Admin', 'Admin', 1, '', 'admin@admin.com', '$2a$10$y9e4QV2mGc.j2l81n82KbOpDJB2m9O564pEOwLj58TsztFn6Fg552', 1);
(4, 'Romain', 'Benaya', 'Romich', 'rb@etu.imt-lille-douai.fr', '$2a$10$EsNS5onYP0YacQR6Kpbgqu1r1nPXM3ag/dNVhD.Ui3eSJZkgkhYau', 0);
-- --
-- Index pour les tables déchargées -- Index pour les tables déchargées
-- --
-- --
-- Index pour la table `game` -- Index pour la table `games`
-- --
ALTER TABLE `game` ALTER TABLE `games`
ADD PRIMARY KEY (`id`); ADD PRIMARY KEY (`id`);
-- --
-- Index pour la table `tournament` -- Index pour la table `messages`
-- --
ALTER TABLE `tournament` ALTER TABLE `messages`
ADD PRIMARY KEY (`id`), ADD PRIMARY KEY (`id`),
ADD KEY `id_game` (`id_game`,`id_user`), ADD KEY `id_user` (`id_user`),
ADD KEY `id_user_private` (`id_user_private`);
--
-- Index pour la table `sessions`
--
ALTER TABLE `sessions`
ADD PRIMARY KEY (`id`),
ADD KEY `id_user` (`id_user`);
--
-- Index pour la table `tournaments`
--
ALTER TABLE `tournaments`
ADD PRIMARY KEY (`id`),
ADD KEY `id_game` (`id_game`),
ADD KEY `id_user` (`id_user`); ADD KEY `id_user` (`id_user`);
-- --
...@@ -113,30 +137,43 @@ ALTER TABLE `users` ...@@ -113,30 +137,43 @@ ALTER TABLE `users`
-- --
-- --
-- AUTO_INCREMENT pour la table `game` -- AUTO_INCREMENT pour la table `games`
-- --
ALTER TABLE `game` ALTER TABLE `games`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
-- --
-- AUTO_INCREMENT pour la table `tournament` -- AUTO_INCREMENT pour la table `tournaments`
-- --
ALTER TABLE `tournament` ALTER TABLE `tournaments`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5; MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1;
-- --
-- AUTO_INCREMENT pour la table `users` -- AUTO_INCREMENT pour la table `users`
-- --
ALTER TABLE `users` ALTER TABLE `users`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9; MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
-- --
-- Contraintes pour les tables déchargées -- Contraintes pour les tables déchargées
-- --
-- --
-- Contraintes pour la table `tournament` -- Contraintes pour la table `messages`
--
ALTER TABLE `messages`
ADD CONSTRAINT `messages_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `messages_ibfk_2` FOREIGN KEY (`id_user_private`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Contraintes pour la table `sessions`
--
ALTER TABLE `sessions`
ADD CONSTRAINT `sessions_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Contraintes pour la table `tournaments`
-- --
ALTER TABLE `tournament` ALTER TABLE `tournaments`
ADD CONSTRAINT `tournament_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `tournaments_ibfk_1` FOREIGN KEY (`id_user`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `tournament_ibfk_2` FOREIGN KEY (`id_game`) REFERENCES `game` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; ADD CONSTRAINT `tournaments_ibfk_2` FOREIGN KEY (`id_game`) REFERENCES `games` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment