-
Notifications
You must be signed in to change notification settings - Fork 0
/
tester.txt
49 lines (46 loc) · 1.34 KB
/
tester.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
tester retset
CREATE TABLE `lab1`.`user` (
`username` VARCHAR(30) NOT NULL,
`password` CHAR(20) NOT NULL,
`firstname` VARCHAR(30) NULL,
`lastname` VARCHAR(30) NULL,
PRIMARY KEY (`username`));
REATE TABLE `lab1`.`flow` (
`id` INT NOT NULL AUTO_INCREMENT,
`message` VARCHAR(45) NULL,
`timestamp` DATETIME NOT NULL,
`sender` VARCHAR(30) NULL,
`reciever` VARCHAR(30) NULL,
`type` INT(1) NULL,
PRIMARY KEY (`id`),
INDEX `username_idx` (`sender` ASC),
INDEX `username_idx1` (`reciever` ASC),
CONSTRAINT `sender`
FOREIGN KEY (`sender`)
REFERENCES `lab1`.`user` (`username`)
ON DELETE CASCADE
ON UPDATE NO ACTION,
CONSTRAINT `reciever`
FOREIGN KEY (`reciever`)
REFERENCES `lab1`.`user` (`username`)
ON DELETE CASCADE
ON UPDATE NO ACTION);
CREATE TABLE `lab1`.`chat` (
`id` INT NOT NULL AUTO_INCREMENT,
`sender` VARCHAR(30) NOT NULL,
`reciever` VARCHAR(30) NOT NULL,
`checked` INT(1) NULL,
`timestamp` DATETIME NULL,
PRIMARY KEY (`id`),
INDEX `sender_idx` (`sender` ASC),
INDEX `reciever_idx` (`reciever` ASC),
CONSTRAINT `chat_sender`
FOREIGN KEY (`sender`)
REFERENCES `lab1`.`user` (`username`)
ON DELETE CASCADE
ON UPDATE NO ACTION,
CONSTRAINT `chat_reciever`
FOREIGN KEY (`reciever`)
REFERENCES `lab1`.`user` (`username`)
ON DELETE CASCADE
ON UPDATE NO ACTION);