-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtables_pg.sql
51 lines (37 loc) · 1.13 KB
/
tables_pg.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
------------------------------------------------------------------
-- My2Pg 1.32 translated dump
--
------------------------------------------------------------------
CREATE USER frf_secret NOSUPERUSER ;
CREATE DATABASE frf_secret;
\c frf_secret
BEGIN;
CREATE TABLE "comments" (
"id" SERIAL,
"createdAt" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
"body" text NOT NULL,
"token" char(50) NOT NULL,
PRIMARY KEY ("createdAt")
);
CREATE TABLE "keys" (
"Username" varchar(30),
"pub_key" TEXT DEFAULT '' NOT NULL,
"secret_data" TEXT DEFAULT '' NOT NULL,
"write_token" varchar(1024),
PRIMARY KEY ("Username")
);
CREATE TABLE "posts" (
"id" SERIAL,
"createdAt" timestamp NOT NULL DEFAULT '0001-01-01 00:00:00',
"body" text NOT NULL,
"token" char(50) NOT NULL,
PRIMARY KEY ("createdAt")
);
create index on "posts" ("createdAt" );
create index on "comments" ("createdAt");
grant all on keys to frf_secret;
grant all on posts to frf_secret;
grant all on comments to frf_secret;
grant USAGE, select on sequence posts_id_seq to frf_secret;
grant USAGE, select on sequence comments_id_seq to frf_secret;
COMMIT;