forked from benoitletondor/TwitterBot
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdb_postgres.sql
66 lines (55 loc) · 1.46 KB
/
db_postgres.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
-- Database init
CREATE USER jose WITH UNENCRYPTED PASSWORD 'jose';
CREATE DATABASE "jose";
GRANT ALL ON DATABASE "jose" TO "jose";
-- Switch to the audiences db as the audiences user.
\connect "jose";
set role "jose";
--
-- Table structure for table "follow"
--
CREATE TABLE "follow" (
"id" SERIAL PRIMARY KEY,
"userid" BIGINT NOT NULL,
"username" varchar(100) NOT NULL,
"status" text,
"followdate" TIMESTAMP WITH TIME ZONE NOT NULL,
"unfollowdate" TIMESTAMP WITH TIME ZONE DEFAULT NULL,
"lastaction" TIMESTAMP WITH TIME ZONE NOT NULL
);
CREATE INDEX ON "follow" ("userid");
--
-- Table structure for table "tweet"
--
CREATE TABLE "tweet" (
"id" SERIAL PRIMARY KEY,
"content" text NOT NULL,
"date" TIMESTAMP WITH TIME ZONE NOT NULL
);
CREATE INDEX ON "tweet" ("content");
--
-- Table structure for table "reply"
--
CREATE TABLE "reply" (
"id" SERIAL PRIMARY KEY,
"userid" BIGINT NOT NULL,
"username" VARCHAR(100) NOT NULL,
"tweetid" BIGINT NOT NULL,
"status" TEXT NOT NULL,
"answer" TEXT NOT NULL,
"replydate" TIMESTAMP WITH TIME ZONE NOT NULL
);
CREATE INDEX ON "reply" ("tweetid");
--
-- Table structure for table "favorite"
--
CREATE TABLE "favorite" (
"id" SERIAL PRIMARY KEY,
"userid" BIGINT NOT NULL,
"username" VARCHAR(100) NOT NULL,
"tweetid" BIGINT NOT NULL,
"status" TEXT NOT NULL,
"favdate" TIMESTAMP WITH TIME ZONE NOT NULL,
"unfavdate" TIMESTAMP WITH TIME ZONE NULL,
"lastaction" TIMESTAMP WITH TIME ZONE NOT NULL
);