-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathinit_postgres_db.sql
More file actions
31 lines (28 loc) · 967 Bytes
/
init_postgres_db.sql
File metadata and controls
31 lines (28 loc) · 967 Bytes
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
CREATE TABLE IF NOT EXISTS comments (
id serial primary key,
post_id integer DEFAULT 0,
text text DEFAULT '',
name text DEFAULT '',
"time" timestamp without time zone DEFAULT now(),
t integer DEFAULT date_part('epoch'::text, now())
);
CREATE TABLE IF NOT EXISTS posts (
id serial primary key,
text text DEFAULT ''::text,
title text DEFAULT ''::text,
"time" timestamp without time zone DEFAULT now(),
nr_comments integer DEFAULT 0,
nr_views integer DEFAULT 0,
is_blog boolean DEFAULT false,
last_reply timestamp without time zone DEFAULT now(),
is_deleted boolean DEFAULT false,
is_locked bool default false
);
CREATE TABLE IF NOT EXISTS users (
id serial primary key,
name text DEFAULT ''::text,
is_banned bool default false,
is_admin bool default false
);
GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO vorum;
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO vorum;