-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBanco.txt
50 lines (45 loc) · 1.16 KB
/
Banco.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
50
-- SQLite
PRAGMA foreign_keys = ON;
CREATE TABLE TAREFA IF NOT EXISTS (
ID INTEGER PRIMARY KEY,
NOME TEXT,
DESCRICAO TEXT,
TIPO_ID INTEGER,
STATUS_ID INTEGER ,
PRIORIDADE_ID INTEGER,
USUARIO_ID INTEGER
ON DELETE CASCADE
ON UPDATE CASCADE;
);
CREATE TABLE TIPO IF NOT EXISTS (
ID_TIPO INTEGER PRIMARY KEY,
NOME TEXT,
USUARIO_ID INTEGER
FOREIGN KEY(ID_TIPO) REFERENCES TAREFA(TIPO_ID)
ON DELETE CASCADE
ON UPDATE CASCADE;
);
CREATE TABLE STATUS IF NOT EXISTS (
ID_STATUS INTEGER PRIMARY KEY,
NOME TEXT,
FOREIGN KEY(ID_STATUS) REFERENCES TAREFA(STATUS_ID)
ON DELETE CASCADE
ON UPDATE CASCADE;
);
CREATE TABLE PRIORIDADE IF NOT EXISTS (
ID_PRIORIDADE INTEGER PRIMARY KEY,
NOME TEXT,
FOREIGN KEY(ID_PRIORIDADE) REFERENCES TAREFA(PRIORIDADE_ID)
ON DELETE CASCADE
ON UPDATE CASCADE;
);
CREATE TABLE USUARIO IF NOT EXISTS (
ID INTEGER PRIMARY KEY,
USERNAME TEXT,
EMAIL TEXT,
SENHA TEXT,
FOREIGN KEY(ID) REFERENCES TAREFA(USUARIO_ID)
FOREIGN KEY(ID) REFERENCES TIPO(USUARIO_ID)
ON DELETE CASCADE
ON UPDATE CASCADE;
)