forked from oltpbenchmark/oltpbench
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bebopt_dev
51 lines (46 loc) · 1.4 KB
/
bebopt_dev
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
-- PostgreSQL DDL
DROP TABLE IF EXISTS "user" cascade;
CREATE TABLE "user" (
u_id int NOT NULL,
name varchar(128) DEFAULT NULL,
PRIMARY KEY (u_id)
);
DROP TABLE IF EXISTS "item" cascade;
CREATE TABLE "item" (
i_id int NOT NULL,
title varchar(20) DEFAULT NULL,
PRIMARY KEY (i_id)
);
DROP TABLE IF EXISTS "review";
CREATE TABLE "review" (
a_id int NOT NULL,
u_id int NOT NULL REFERENCES "user" (u_id),
i_id int NOT NULL REFERENCES "item" (i_id),
rating int DEFAULT NULL,
rank int DEFAULT NULL
);
CREATE INDEX IDX_RATING_UID ON "review" (u_id);
CREATE INDEX IDX_RATING_AID ON "review" (a_id);
CREATE INDEX IDX_RATING_IID ON "review" (i_id);
DROP TABLE IF EXISTS "review_rating";
CREATE TABLE "review_rating" (
u_id int NOT NULL REFERENCES "user" (u_id),
a_id int NOT NULL,
rating int NOT NULL,
status int NOT NULL,
creation_date timestamp DEFAULT NULL,
last_mod_date timestamp DEFAULT NULL,
type int DEFAULT NULL,
vertical_id int DEFAULT NULL
);
CREATE INDEX IDX_REVIEW_RATING_UID ON "review_rating" (u_id);
CREATE INDEX IDX_REVIEW_RATING_AID ON "review_rating" (a_id);
DROP TABLE IF EXISTS "trust";
CREATE TABLE "trust" (
source_u_id int NOT NULL REFERENCES "user" (u_id),
target_u_id int NOT NULL REFERENCES "user" (u_id),
trust int NOT NULL,
creation_date timestamp DEFAULT NULL
);
CREATE INDEX IDX_TRUST_SID ON trust (source_u_id);
CREATE INDEX IDX_TRUST_TID ON trust (target_u_id);