-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
123 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
DROP TABLE IF EXISTS EXERCICE_GROUP; | ||
DROP TABLE IF EXISTS TAG_EXERCICE; | ||
|
||
DROP TABLE IF EXISTS TOKEN; | ||
DROP TABLE IF EXISTS JOB; | ||
DROP TABLE IF EXISTS RESULT; | ||
DROP TABLE IF EXISTS EXERCICE; | ||
DROP TABLE IF EXISTS USER; | ||
DROP TABLE IF EXISTS `GROUP`; | ||
DROP TABLE IF EXISTS `JOB_INFO`; | ||
DROP TABLE IF EXISTS TAG; | ||
DROP TABLE IF EXISTS `UPLOAD`; | ||
|
||
create table EXERCICE ( | ||
id INT NOT NULL auto_increment, | ||
title VARCHAR(200) DEFAULT NULL, | ||
description TEXT DEFAULT NULL, | ||
inputFile TEXT DEFAULT NULL, | ||
outputFile TEXT DEFAULT NULL, | ||
points INT DEFAULT NULL, | ||
creatingDate DATETIME DEFAULT CURRENT_TIMESTAMP, | ||
PRIMARY KEY (id) | ||
); | ||
|
||
CREATE TABLE USER ( | ||
id INT NOT NULL AUTO_INCREMENT, | ||
username VARCHAR(200) NOT NULL, | ||
firstname VARCHAR(200) DEFAULT NULL, | ||
surname VARCHAR(200) DEFAULT NULL, | ||
|
||
role VARCHAR(50) DEFAULT '', | ||
|
||
PRIMARY KEY (id) | ||
); | ||
|
||
create table `GROUP` ( | ||
id INT NOT NULL auto_increment, | ||
name VARCHAR(200) DEFAULT NULL, | ||
description TEXT DEFAULT NULL, | ||
publicationDate DATETIME DEFAULT CURRENT_TIMESTAMP, | ||
endDate DATETIME DEFAULT NULL, | ||
points INT DEFAULT NULL, | ||
imageUrl TEXT NOT NULL, | ||
PRIMARY KEY (id) | ||
); | ||
|
||
|
||
CREATE TABLE `JOB_INFO` ( | ||
id INT NOT NULL AUTO_INCREMENT, | ||
uuid VARCHAR(36) NOT NULL, | ||
execTime DATETIME DEFAULT CURRENT_TIMESTAMP, | ||
msgType VARCHAR(20) NOT NULL, | ||
msgInfo TEXT, | ||
PRIMARY KEY (id) | ||
); | ||
|
||
CREATE TABLE EXERCICE_GROUP ( | ||
exercice_id INT NOT NULL, | ||
group_id INT NOT NULL, | ||
PRIMARY KEY (exercice_id, group_id), | ||
FOREIGN KEY (exercice_id) REFERENCES EXERCICE (id) | ||
ON DELETE CASCADE, | ||
FOREIGN KEY (group_id) REFERENCES `GROUP` (id) | ||
ON DELETE CASCADE | ||
); | ||
|
||
|
||
CREATE TABLE RESULT ( | ||
id INT NOT NULL AUTO_INCREMENT, | ||
point INT NOT NULL, | ||
exercice_id INT NOT NULL, | ||
PRIMARY KEY (id), | ||
user_id INT NOT NULL, | ||
FOREIGN KEY (exercice_id) REFERENCES EXERCICE (id) | ||
ON DELETE CASCADE, | ||
FOREIGN KEY (user_id) REFERENCES USER (id) | ||
ON DELETE CASCADE | ||
); | ||
|
||
create table TAG ( | ||
id INT NOT NULL auto_increment, | ||
color VARCHAR(6) DEFAULT NULL, | ||
tag VARCHAR(50) DEFAULT NULL, | ||
PRIMARY KEY (id) | ||
); | ||
|
||
CREATE TABLE TAG_EXERCICE ( | ||
tag_id INT NOT NULL, | ||
exercice_id INT NOT NULL, | ||
PRIMARY KEY (tag_id, exercice_id), | ||
FOREIGN KEY (exercice_id) REFERENCES EXERCICE (id) | ||
ON DELETE CASCADE, | ||
FOREIGN KEY (tag_id) REFERENCES TAG (id) | ||
ON DELETE CASCADE | ||
); | ||
|
||
CREATE TABLE TOKEN ( | ||
token VARCHAR(127) NOT NULL PRIMARY KEY, | ||
accessToken VARCHAR(127) NOT NULL, | ||
user_id INT NOT NULL, | ||
FOREIGN KEY (user_id) REFERENCES USER(id) | ||
ON DELETE CASCADE | ||
); | ||
|
||
CREATE TABLE `UPLOAD` ( | ||
id INT NOT NULL AUTO_INCREMENT, | ||
filename VARCHAR(50) NOT NULL, | ||
PRIMARY KEY (id) | ||
); | ||
|
||
CREATE TABLE `JOB` ( | ||
uuid VARCHAR(36) NOT NULL, | ||
user_id INT NOT NULL, | ||
exercice_id INT NOT NULL, | ||
PRIMARY KEY (uuid), | ||
FOREIGN KEY (exercice_id) REFERENCES EXERCICE (id) | ||
ON DELETE CASCADE, | ||
FOREIGN KEY (user_id) REFERENCES USER (id) | ||
ON DELETE CASCADE | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
DROP TABLE IF EXISTS TAG_EXERCICE; | ||
DROP TABLE IF EXISTS TAG; | ||
create table TAG ( | ||
id INT NOT NULL auto_increment, | ||
|