forked from panmourovaty/rustvideoplatform
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatabase_schema.sql
33 lines (33 loc) · 942 Bytes
/
database_schema.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
CREATE TABLE public.media (
id varchar NOT NULL,
"name" varchar NOT NULL,
description text NOT NULL,
upload int8 DEFAULT EXTRACT(epoch FROM now()) NOT NULL,
"owner" varchar NOT NULL,
likes int8 DEFAULT 0 NOT NULL,
dislikes int8 DEFAULT 0 NOT NULL,
"views" int8 DEFAULT 0 NOT NULL,
public bool DEFAULT false NOT NULL,
"type" varchar NOT NULL,
CONSTRAINT videos_pk PRIMARY KEY (id)
);
CREATE TABLE public."comments" (
id bigserial NOT NULL,
media varchar NOT NULL,
"user" varchar NOT NULL,
"text" text NOT NULL,
"time" int8 DEFAULT EXTRACT(epoch FROM now()) NOT NULL,
CONSTRAINT comments_pk PRIMARY KEY (id)
);
CREATE TABLE public.users (
login varchar(40) NOT NULL,
name varchar(100) NOT NULL,
password_hash varchar NOT NULL,
profile_picture varchar,
channel_picture varchar,
CONSTRAINT users_pk PRIMARY KEY (login)
);
CREATE TABLE public.subscriptions (
subscriber varchar(40) NOT NULL,
target varchar(40) NOT NULL
);