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)
|
PRIMARY KEY(id)
|
||||||
) ENGINE = INNODB;
|
) ENGINE = INNODB;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS GROUP_CONTENT
|
CREATE TABLE IF NOT EXISTS TUTORSHIP
|
||||||
(
|
(
|
||||||
id BIGINT NOT NULL AUTO_INCREMENT,
|
id BIGINT NOT NULL AUTO_INCREMENT,
|
||||||
group_id BIGINT NOT NULL,
|
group_id BIGINT NOT NULL,
|
||||||
@ -55,19 +55,19 @@ CREATE TABLE IF NOT EXISTS GROUP_CONTENT
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS LIVRET
|
CREATE TABLE IF NOT EXISTS LIVRET
|
||||||
(
|
(
|
||||||
id BIGINT NOT NULL AUTO_INCREMENT,
|
id BIGINT NOT NULL AUTO_INCREMENT,
|
||||||
group_content_id BIGINT,
|
tutorship_id BIGINT,
|
||||||
etutor_name VARCHAR(128) NOT NULL,
|
etutor_name VARCHAR(128) NOT NULL,
|
||||||
etutor_email VARCHAR(256) NOT NULL,
|
etutor_email VARCHAR(256) NOT NULL,
|
||||||
etutor_phone VARCHAR(15) NOT NULL,
|
etutor_phone VARCHAR(15) NOT NULL,
|
||||||
company_name VARCHAR(256) NOT NULL,
|
company_name VARCHAR(256) NOT NULL,
|
||||||
company_address VARCHAR(512) NOT NULL,
|
company_address VARCHAR(512) NOT NULL,
|
||||||
contract_type INT NOT NULL,
|
contract_type INT NOT NULL,
|
||||||
contract_start DATE NOT NULL,
|
contract_start DATE NOT NULL,
|
||||||
contract_end DATE NOT NULL,
|
contract_end DATE NOT NULL,
|
||||||
ressources_dir VARCHAR(512),
|
ressources_dir VARCHAR(512),
|
||||||
opened TINYINT(1) NOT NULL,
|
opened TINYINT(1) NOT NULL,
|
||||||
expire DATE NOT NULL,
|
expire DATE NOT NULL,
|
||||||
PRIMARY KEY(id)
|
PRIMARY KEY(id)
|
||||||
) ENGINE = INNODB;
|
) ENGINE = INNODB;
|
||||||
|
|
||||||
@ -86,9 +86,9 @@ CREATE TABLE IF NOT EXISTS PERIOD
|
|||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS HASHTABLE
|
CREATE TABLE IF NOT EXISTS HASHTABLE
|
||||||
(
|
(
|
||||||
token VARCHAR(255) NOT NULL,
|
token VARCHAR(255) NOT NULL,
|
||||||
exipre DATE NOT NULL,
|
exipre DATE NOT NULL,
|
||||||
period INT NOT NULL,
|
period_id BIGINT NOT NULL,
|
||||||
PRIMARY KEY(token)
|
PRIMARY KEY(token)
|
||||||
) ENGINE = INNODB;
|
) ENGINE = INNODB;
|
||||||
|
|
||||||
@ -98,34 +98,34 @@ ALTER TABLE `GROUP`
|
|||||||
ADD FOREIGN KEY (resp_id)
|
ADD FOREIGN KEY (resp_id)
|
||||||
REFERENCES `USER`(id)
|
REFERENCES `USER`(id)
|
||||||
;
|
;
|
||||||
|
|
||||||
ALTER TABLE GROUP_CONTENT
|
ALTER TABLE TUTORSHIP
|
||||||
ADD FOREIGN KEY (group_id)
|
ADD FOREIGN KEY (group_id)
|
||||||
REFERENCES `GROUP`(id)
|
REFERENCES `GROUP`(id)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
ON UPDATE CASCADE
|
ON UPDATE CASCADE
|
||||||
;
|
;
|
||||||
|
|
||||||
ALTER TABLE GROUP_CONTENT
|
ALTER TABLE TUTORSHIP
|
||||||
ADD FOREIGN KEY (student_id)
|
ADD FOREIGN KEY (student_id)
|
||||||
REFERENCES `USER`(id)
|
REFERENCES `USER`(id)
|
||||||
;
|
;
|
||||||
|
|
||||||
ALTER TABLE GROUP_CONTENT
|
ALTER TABLE TUTORSHIP
|
||||||
ADD FOREIGN KEY (ptutor_id)
|
ADD FOREIGN KEY (ptutor_id)
|
||||||
REFERENCES `USER`(id)
|
REFERENCES `USER`(id)
|
||||||
;
|
;
|
||||||
|
|
||||||
ALTER TABLE LIVRET
|
ALTER TABLE LIVRET
|
||||||
ADD FOREIGN KEY (group_content_id)
|
ADD FOREIGN KEY (tutorship_id)
|
||||||
REFERENCES GROUP_CONTENT(id)
|
REFERENCES TUTORSHIP (id)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
ON UPDATE CASCADE
|
ON UPDATE CASCADE
|
||||||
;
|
;
|
||||||
|
|
||||||
ALTER TABLE LIVRET
|
ALTER TABLE LIVRET
|
||||||
ADD FOREIGN KEY (group_content_id)
|
ADD FOREIGN KEY (tutorship_id)
|
||||||
REFERENCES GROUP_CONTENT(id)
|
REFERENCES TUTORSHIP (id)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
ON UPDATE CASCADE
|
ON UPDATE CASCADE
|
||||||
;
|
;
|
||||||
@ -137,7 +137,7 @@ REFERENCES LIVRET (id)
|
|||||||
ON UPDATE CASCADE;
|
ON UPDATE CASCADE;
|
||||||
|
|
||||||
ALTER TABLE HASHTABLE
|
ALTER TABLE HASHTABLE
|
||||||
ADD FOREIGN KEY (period)
|
ADD FOREIGN KEY (period_id)
|
||||||
REFERENCES PERIOD (id)
|
REFERENCES PERIOD (id)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
ON UPDATE CASCADE
|
ON UPDATE CASCADE
|
||||||
|
Reference in New Issue
Block a user