-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserverSQLbuilder.txt
More file actions
46 lines (44 loc) · 1.06 KB
/
serverSQLbuilder.txt
File metadata and controls
46 lines (44 loc) · 1.06 KB
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
DROP TABLE if EXISTS user;
DROP TABLE if EXISTS person;
DROP TABLE if EXISTS event;
DROP TABLE if EXISTS authtoken;
CREATE TABLE user(
Username text not null unique,
Password text not null,
Email text not null,
FirstName text not null,
LastName text not null,
Gender text,
PersonID text not null,
PRIMARY KEY (Username)
);
CREATE TABLE person(
PersonID text not null unique,
Username text not null,
FirstName text not null,
LastName text not null,
Gender text,
FatherID text not null,
MotherID text not null,
SpouseID text not null,
PRIMARY KEY (PersonID)
);
CREATE TABLE event(
EventID text not null unique,
AssociatedUsername text not null,
PersonID text not null,
Latitude float not null,
Longitude float not null,
Country text not null,
City text not null,
EventType text not null,
Year int not null,
primary key (EventID),
foreign key (AssociatedUsername) references Users(Username),
foreign key (PersonID) references person(PersonID)
);
CREATE TABLE authtoken(
token varchar(32) not null,
username varchar(32) not null,
PRIMARY KEY (token)
);