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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
drop table if exists persons;
CREATE TABLE persons (
id int NOT NULL,
name varchar(255) NOT NULL,
surname varchar(255) NOT NULL,
password varchar(64)
);
drop table if exists institutes;
CREATE TABLE institutes (
id int NOT NULL,
name varchar(255)
);
drop table if exists documents;
CREATE TABLE documents (
id int NOT NULL,
title varchar(255) NOT NULL,
abstract varchar(255)
);
drop table if exists authors_docs;
CREATE TABLE authors_docs (
pers_id int NOT NULL,
doc_id int NOT NULL
);
drop table if exists phones;
CREATE TABLE phones (
id int NOT NULL ,
phone varchar(255) NOT NULL ,
pers_id int NOT NULL
);
drop table if exists certs;
CREATE TABLE certs (
id int NOT NULL ,
cert LONGBLOB NOT NULL,
pers_id int NOT NULL
);
ALTER TABLE authors_docs ADD
CONSTRAINT PK_authors_docs PRIMARY KEY
(
pers_id,
doc_id
);
ALTER TABLE documents ADD
CONSTRAINT PK_documents PRIMARY KEY
(
id
);
ALTER TABLE institutes ADD
CONSTRAINT PK_institutes PRIMARY KEY
(
id
);
ALTER TABLE persons ADD
CONSTRAINT PK_persons PRIMARY KEY
(
id
);
ALTER TABLE phones ADD
CONSTRAINT PK_phones PRIMARY KEY
(
id
);
ALTER TABLE certs ADD
CONSTRAINT PK_certs PRIMARY KEY
(
id
);
drop table if exists referrals;
CREATE TABLE referrals (
id int NOT NULL,
name varchar(255) NOT NULL,
url varchar(255) NOT NULL
);
|