TG-104 : Modif structure BDD
This commit is contained in:
parent
534af3f7bb
commit
228af15b44
@ -44,7 +44,7 @@ CREATE TABLE IF NOT EXISTS `USER`
|
||||
PRIMARY KEY(id)
|
||||
) ENGINE = INNODB;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS GROUP_CONTENT
|
||||
CREATE TABLE IF NOT EXISTS TUTORSHIP
|
||||
(
|
||||
id BIGINT NOT NULL AUTO_INCREMENT,
|
||||
group_id BIGINT NOT NULL,
|
||||
@ -56,7 +56,7 @@ CREATE TABLE IF NOT EXISTS GROUP_CONTENT
|
||||
CREATE TABLE IF NOT EXISTS LIVRET
|
||||
(
|
||||
id BIGINT NOT NULL AUTO_INCREMENT,
|
||||
group_content_id BIGINT,
|
||||
tutorship_id BIGINT,
|
||||
etutor_name VARCHAR(128) NOT NULL,
|
||||
etutor_email VARCHAR(256) NOT NULL,
|
||||
etutor_phone VARCHAR(15) NOT NULL,
|
||||
@ -88,7 +88,7 @@ CREATE TABLE IF NOT EXISTS HASHTABLE
|
||||
(
|
||||
token VARCHAR(255) NOT NULL,
|
||||
exipre DATE NOT NULL,
|
||||
period INT NOT NULL,
|
||||
period_id BIGINT NOT NULL,
|
||||
PRIMARY KEY(token)
|
||||
) ENGINE = INNODB;
|
||||
|
||||
@ -99,33 +99,33 @@ ALTER TABLE `GROUP`
|
||||
REFERENCES `USER`(id)
|
||||
;
|
||||
|
||||
ALTER TABLE GROUP_CONTENT
|
||||
ALTER TABLE TUTORSHIP
|
||||
ADD FOREIGN KEY (group_id)
|
||||
REFERENCES `GROUP`(id)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE
|
||||
;
|
||||
|
||||
ALTER TABLE GROUP_CONTENT
|
||||
ALTER TABLE TUTORSHIP
|
||||
ADD FOREIGN KEY (student_id)
|
||||
REFERENCES `USER`(id)
|
||||
;
|
||||
|
||||
ALTER TABLE GROUP_CONTENT
|
||||
ALTER TABLE TUTORSHIP
|
||||
ADD FOREIGN KEY (ptutor_id)
|
||||
REFERENCES `USER`(id)
|
||||
;
|
||||
|
||||
ALTER TABLE LIVRET
|
||||
ADD FOREIGN KEY (group_content_id)
|
||||
REFERENCES GROUP_CONTENT(id)
|
||||
ADD FOREIGN KEY (tutorship_id)
|
||||
REFERENCES TUTORSHIP (id)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE
|
||||
;
|
||||
|
||||
ALTER TABLE LIVRET
|
||||
ADD FOREIGN KEY (group_content_id)
|
||||
REFERENCES GROUP_CONTENT(id)
|
||||
ADD FOREIGN KEY (tutorship_id)
|
||||
REFERENCES TUTORSHIP (id)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE
|
||||
;
|
||||
@ -137,7 +137,7 @@ REFERENCES LIVRET (id)
|
||||
ON UPDATE CASCADE;
|
||||
|
||||
ALTER TABLE HASHTABLE
|
||||
ADD FOREIGN KEY (period)
|
||||
ADD FOREIGN KEY (period_id)
|
||||
REFERENCES PERIOD (id)
|
||||
ON DELETE CASCADE
|
||||
ON UPDATE CASCADE
|
||||
|
Reference in New Issue
Block a user