-
Notifications
You must be signed in to change notification settings - Fork 0
/
DB.txt
43 lines (37 loc) · 1.21 KB
/
DB.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
CREATE TABLE IF NOT EXISTS Users (
idUser INTEGER NOT NULL ,
username VARCHAR(15),
password VARCHAR(30),
salt VARCHAR(30),
nome CHAR(20),
email VARCHAR(30),
birth_date DATE,
image VARCHAR(50),
admin BOOLEAN,
CONSTRAINT pk_users PRIMARY KEY (idUser),
CONSTRAINT u_user UNIQUE (username));
CREATE TABLE IF NOT EXISTS Events (
idEvent INTEGER NOT NULL ,
idUser INTEGER,
description VARCHAR,
event_type CHAR(30),
image_link VARCHAR(50),
event_date DATE,
public BOOLEAN, Place VARCHAR(30),
CONSTRAINT pk_events PRIMARY KEY (idEvent),
CONSTRAINT fk_users FOREIGN KEY (idUser) REFERENCES Users(idUser));
CREATE TABLE IF NOT EXISTS Registers (
idRegister INTEGER NOT NULL ,
idUser INTEGER,
idEvent INTEGER,
CONSTRAINT pk_registers PRIMARY KEY (idRegister),
CONSTRAINT fk_users FOREIGN KEY (idUser) REFERENCES Users (idUser),
CONSTRAINT fk_events FOREIGN KEY (idEvent) REFERENCES Events (idEvent));
CREATE TABLE IF NOT EXISTS Comments (
idComment INTEGER NOT NULL ,
idUser INTEGER,
idEvent INTEGER,
text VARCHAR,
CONSTRAINT pk_comments PRIMARY KEY (idComment),
CONSTRAINT fk_users FOREIGN KEY (idUser) REFERENCES Users (idUser),
CONSTRAINT fk_events FOREIGN KEY (idEvent) REFERENCES Events (idEvent));