-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathstructure.sql
67 lines (60 loc) · 1.1 KB
/
structure.sql
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
CREATE TABLE friend (
id SERIAL PRIMARY KEY,
user_id BIGINT,
friend_user_id BIGINT,
request_accepted BOOL,
UNIQUE (user_id, friend_user_id)
);
CREATE TABLE messages (
id SERIAL PRIMARY KEY,
user_id BIGINT,
user_id_to BIGINT,
is_out BOOL,
message TEXT,
ts BIGINT,
UNIQUE (user_id,user_id_to,ts)
);
CREATE TABLE timeline (
id SERIAL PRIMARY KEY,
user_id BIGINT,
source_user_id BIGINT,
message TEXT,
ts BIGINT,
UNIQUE (user_id,ts)
);
CREATE TABLE socialuser (
id SERIAL PRIMARY KEY,
email VARCHAR(255),
password VARCHAR(80),
name VARCHAR(255),
have_avatar BOOL,
UNIQUE (email)
);
CREATE TABLE userinfo (
user_id INT NOT NULL PRIMARY KEY,
name VARCHAR(255),
birthdate DATE,
sex INT,
description TEXT,
city_id INT,
family_position INT
);
CREATE TABLE city (
id SERIAL PRIMARY KEY,
name VARCHAR(255),
lon REAL,
lat REAL,
UNIQUE (name)
);
CREATE TABLE hashes (
id SERIAL PRIMARY KEY,
name VARCHAR(255),
UNIQUE(name)
);
CREATE TABLE hashtimeline (
id SERIAL PRIMARY KEY,
hash_id BIGINT,
timeline_id BIGINT,
ts BIGINT,
INDEX(hash_id, ts)
);