Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
projet-cdaw
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Raphaël PEIM
projet-cdaw
Commits
5bb4126c
Commit
5bb4126c
authored
Dec 04, 2020
by
raphael.peim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Edit createDB.sql
parent
b409ddff
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
154 additions
and
80 deletions
+154
-80
createDB.sql
AGL/BD/createDB.sql
+77
-40
createDB.sql
BackEnd/api/sql/createDB.sql
+77
-40
No files found.
AGL/BD/createDB.sql
View file @
5bb4126c
...
...
@@ -3,7 +3,7 @@
-- https://www.phpmyadmin.net/
--
-- Hôte : localhost:8889
-- Généré le : jeu
. 03 déc. 2020 à 22:19
-- Généré le : jeu
di. 03 déc. 2020 à 14:20
-- Version du serveur : 5.7.26
-- Version de PHP : 7.4.2
...
...
@@ -17,44 +17,52 @@ SET time_zone = "+00:00";
-- --------------------------------------------------------
--
-- Structure de la table `game`
-- Structure de la table `game
s
`
--
CREATE
TABLE
`game
`
(
CREATE
TABLE
IF
NOT
EXISTS
`games
`
(
`id`
int
(
11
)
NOT
NULL
,
`private`
tinyint
(
1
)
NOT
NULL
)
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
(
1
,
0
),
(
2
,
1
);
CREATE
TABLE
IF
NOT
EXISTS
`messages`
(
`id`
int
(
11
)
NOT
NULL
,
`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_game`
int
(
11
)
NOT
NULL
,
`id_user`
int
(
11
)
NOT
NULL
,
`score`
int
(
11
)
NOT
NULL
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
;
`date`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
)
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
(
1
,
1
,
1
,
1250
),
(
2
,
1
,
2
,
1000
),
(
3
,
1
,
4
,
1200
),
(
4
,
1
,
3
,
1000
);
CREATE
TABLE
IF
NOT
EXISTS
`tournaments`
(
`id`
int
(
11
)
NOT
NULL
,
`id_game`
int
(
11
)
NOT
NULL
,
`id_user`
int
(
11
)
NOT
NULL
,
`score`
int
(
11
)
NOT
NULL
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
;
-- --------------------------------------------------------
...
...
@@ -62,11 +70,13 @@ INSERT INTO `tournament` (`id`, `id_game`, `id_user`, `score`) VALUES
-- Structure de la table `users`
--
CREATE
TABLE
`users`
(
CREATE
TABLE
IF
NOT
EXISTS
`users`
(
`id`
int
(
11
)
NOT
NULL
,
`firstname`
varchar
(
50
)
NOT
NULL
,
`lastname`
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
,
`password`
varchar
(
255
)
NOT
NULL
,
`role`
smallint
(
6
)
NOT
NULL
...
...
@@ -76,28 +86,42 @@ CREATE TABLE `users` (
-- Déchargement des données de la table `users`
--
INSERT
INTO
`users`
(
`id`
,
`firstname`
,
`lastname`
,
`login`
,
`email`
,
`password`
,
`role`
)
VALUES
(
1
,
'Raphaël'
,
'Peim'
,
'Raph'
,
'rp@gmail.com'
,
'$2a$10$y9e4QV2mGc.j2l81n82KbOpDJB2m9O564pEOwLj58TsztFn6Fg552'
,
1
),
(
2
,
'John'
,
'Doe'
,
'John'
,
'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
),
(
4
,
'Romain'
,
'Benaya'
,
'Romich'
,
'rb@etu.imt-lille-douai.fr'
,
'$2a$10$EsNS5onYP0YacQR6Kpbgqu1r1nPXM3ag/dNVhD.Ui3eSJZkgkhYau'
,
0
);
INSERT
INTO
`users`
(
`id`
,
`firstname`
,
`lastname`
,
`login`
,
`avatar`
,
`avatar_url`
,
`email`
,
`password`
,
`role`
)
VALUES
(
1
,
'Raphaël'
,
'Peim'
,
'Raph'
,
1
,
''
,
'rp@gmail.com'
,
'$2a$10$y9e4QV2mGc.j2l81n82KbOpDJB2m9O564pEOwLj58TsztFn6Fg552'
,
1
),
(
2
,
'John'
,
'Doe'
,
'John'
,
1
,
''
,
'jd@etu.imt-lille-douai.fr'
,
'$2a$10$EsNS5onYP0YacQR6Kpbgqu1r1nPXM3ag/dNVhD.Ui3eSJZkgkhYau'
,
0
),
(
3
,
'Admin'
,
'Admin'
,
'Admin'
,
1
,
''
,
'admin@admin.com'
,
'$2a$10$y9e4QV2mGc.j2l81n82KbOpDJB2m9O564pEOwLj58TsztFn6Fg552'
,
1
);
--
-- Index pour les tables déchargées
--
--
-- Index pour la table `game`
-- Index pour la table `game
s
`
--
ALTER
TABLE
`game`
ALTER
TABLE
`game
s
`
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
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`
);
--
...
...
@@ -113,30 +137,43 @@ ALTER TABLE `users`
--
--
-- AUTO_INCREMENT pour la table `game`
-- AUTO_INCREMENT pour la table `game
s
`
--
ALTER
TABLE
`game`
MODIFY
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
AUTO_INCREMENT
=
3
;
ALTER
TABLE
`game
s
`
MODIFY
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
AUTO_INCREMENT
=
1
;
--
-- AUTO_INCREMENT pour la table `tournament`
-- AUTO_INCREMENT pour la table `tournament
s
`
--
ALTER
TABLE
`tournament`
MODIFY
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
AUTO_INCREMENT
=
5
;
ALTER
TABLE
`tournament
s
`
MODIFY
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
AUTO_INCREMENT
=
1
;
--
-- AUTO_INCREMENT pour la 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 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`
ADD
CONSTRAINT
`tournament_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
;
ALTER
TABLE
`tournament
s
`
ADD
CONSTRAINT
`tournament
s
_ibfk_1`
FOREIGN
KEY
(
`id_user`
)
REFERENCES
`users`
(
`id`
)
ON
DELETE
CASCADE
ON
UPDATE
CASCADE
,
ADD
CONSTRAINT
`tournament
s_ibfk_2`
FOREIGN
KEY
(
`id_game`
)
REFERENCES
`games
`
(
`id`
)
ON
DELETE
CASCADE
ON
UPDATE
CASCADE
;
BackEnd/api/sql/createDB.sql
View file @
5bb4126c
...
...
@@ -3,7 +3,7 @@
-- https://www.phpmyadmin.net/
--
-- Hôte : localhost:8889
-- Généré le : jeu
. 03 déc. 2020 à 22:19
-- Généré le : jeu
di. 03 déc. 2020 à 14:20
-- Version du serveur : 5.7.26
-- Version de PHP : 7.4.2
...
...
@@ -17,44 +17,52 @@ SET time_zone = "+00:00";
-- --------------------------------------------------------
--
-- Structure de la table `game`
-- Structure de la table `game
s
`
--
CREATE
TABLE
`game
`
(
CREATE
TABLE
IF
NOT
EXISTS
`games
`
(
`id`
int
(
11
)
NOT
NULL
,
`private`
tinyint
(
1
)
NOT
NULL
)
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
(
1
,
0
),
(
2
,
1
);
CREATE
TABLE
IF
NOT
EXISTS
`messages`
(
`id`
int
(
11
)
NOT
NULL
,
`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_game`
int
(
11
)
NOT
NULL
,
`id_user`
int
(
11
)
NOT
NULL
,
`score`
int
(
11
)
NOT
NULL
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
;
`date`
datetime
NOT
NULL
DEFAULT
CURRENT_TIMESTAMP
)
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
(
1
,
1
,
1
,
1250
),
(
2
,
1
,
2
,
1000
),
(
3
,
1
,
4
,
1200
),
(
4
,
1
,
3
,
1000
);
CREATE
TABLE
IF
NOT
EXISTS
`tournaments`
(
`id`
int
(
11
)
NOT
NULL
,
`id_game`
int
(
11
)
NOT
NULL
,
`id_user`
int
(
11
)
NOT
NULL
,
`score`
int
(
11
)
NOT
NULL
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8
;
-- --------------------------------------------------------
...
...
@@ -62,11 +70,13 @@ INSERT INTO `tournament` (`id`, `id_game`, `id_user`, `score`) VALUES
-- Structure de la table `users`
--
CREATE
TABLE
`users`
(
CREATE
TABLE
IF
NOT
EXISTS
`users`
(
`id`
int
(
11
)
NOT
NULL
,
`firstname`
varchar
(
50
)
NOT
NULL
,
`lastname`
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
,
`password`
varchar
(
255
)
NOT
NULL
,
`role`
smallint
(
6
)
NOT
NULL
...
...
@@ -76,28 +86,42 @@ CREATE TABLE `users` (
-- Déchargement des données de la table `users`
--
INSERT
INTO
`users`
(
`id`
,
`firstname`
,
`lastname`
,
`login`
,
`email`
,
`password`
,
`role`
)
VALUES
(
1
,
'Raphaël'
,
'Peim'
,
'Raph'
,
'rp@gmail.com'
,
'$2a$10$y9e4QV2mGc.j2l81n82KbOpDJB2m9O564pEOwLj58TsztFn6Fg552'
,
1
),
(
2
,
'John'
,
'Doe'
,
'John'
,
'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
),
(
4
,
'Romain'
,
'Benaya'
,
'Romich'
,
'rb@etu.imt-lille-douai.fr'
,
'$2a$10$EsNS5onYP0YacQR6Kpbgqu1r1nPXM3ag/dNVhD.Ui3eSJZkgkhYau'
,
0
);
INSERT
INTO
`users`
(
`id`
,
`firstname`
,
`lastname`
,
`login`
,
`avatar`
,
`avatar_url`
,
`email`
,
`password`
,
`role`
)
VALUES
(
1
,
'Raphaël'
,
'Peim'
,
'Raph'
,
1
,
''
,
'rp@gmail.com'
,
'$2a$10$y9e4QV2mGc.j2l81n82KbOpDJB2m9O564pEOwLj58TsztFn6Fg552'
,
1
),
(
2
,
'John'
,
'Doe'
,
'John'
,
1
,
''
,
'jd@etu.imt-lille-douai.fr'
,
'$2a$10$EsNS5onYP0YacQR6Kpbgqu1r1nPXM3ag/dNVhD.Ui3eSJZkgkhYau'
,
0
),
(
3
,
'Admin'
,
'Admin'
,
'Admin'
,
1
,
''
,
'admin@admin.com'
,
'$2a$10$y9e4QV2mGc.j2l81n82KbOpDJB2m9O564pEOwLj58TsztFn6Fg552'
,
1
);
--
-- Index pour les tables déchargées
--
--
-- Index pour la table `game`
-- Index pour la table `game
s
`
--
ALTER
TABLE
`game`
ALTER
TABLE
`game
s
`
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
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`
);
--
...
...
@@ -113,30 +137,43 @@ ALTER TABLE `users`
--
--
-- AUTO_INCREMENT pour la table `game`
-- AUTO_INCREMENT pour la table `game
s
`
--
ALTER
TABLE
`game`
MODIFY
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
AUTO_INCREMENT
=
3
;
ALTER
TABLE
`game
s
`
MODIFY
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
AUTO_INCREMENT
=
1
;
--
-- AUTO_INCREMENT pour la table `tournament`
-- AUTO_INCREMENT pour la table `tournament
s
`
--
ALTER
TABLE
`tournament`
MODIFY
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
AUTO_INCREMENT
=
5
;
ALTER
TABLE
`tournament
s
`
MODIFY
`id`
int
(
11
)
NOT
NULL
AUTO_INCREMENT
,
AUTO_INCREMENT
=
1
;
--
-- AUTO_INCREMENT pour la 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 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`
ADD
CONSTRAINT
`tournament_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
;
ALTER
TABLE
`tournament
s
`
ADD
CONSTRAINT
`tournament
s
_ibfk_1`
FOREIGN
KEY
(
`id_user`
)
REFERENCES
`users`
(
`id`
)
ON
DELETE
CASCADE
ON
UPDATE
CASCADE
,
ADD
CONSTRAINT
`tournament
s_ibfk_2`
FOREIGN
KEY
(
`id_game`
)
REFERENCES
`games
`
(
`id`
)
ON
DELETE
CASCADE
ON
UPDATE
CASCADE
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment