mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-12-13 22:00:29 +05:30
Implement videos table.
This commit is contained in:
parent
8258468f7b
commit
8c52d0eb28
@ -1,3 +1,22 @@
|
|||||||
CREATE INDEX IF NOT EXISTS users_session_id_idx ON users (session_id ASC) STORING (password, username);
|
CREATE INDEX IF NOT EXISTS users_session_id_idx ON users (session_id ASC) STORING (password, username);
|
||||||
|
|
||||||
--rollback DROP INDEX IF EXISTS users_session_id_idx;
|
--rollback DROP INDEX IF EXISTS users_session_id_idx;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS videos (
|
||||||
|
id VARCHAR(16) NOT NULL UNIQUE,
|
||||||
|
duration INT8 NULL,
|
||||||
|
thumbnail VARCHAR(400) NULL,
|
||||||
|
title VARCHAR(120) NULL,
|
||||||
|
uploaded INT8 NULL,
|
||||||
|
views INT8 NULL,
|
||||||
|
uploader_id VARCHAR(24) NOT NULL,
|
||||||
|
is_short BOOL NOT NULL DEFAULT false,
|
||||||
|
CONSTRAINT videos_pkey PRIMARY KEY (id ASC, uploader_id ASC) USING HASH,
|
||||||
|
CONSTRAINT fk_videos_channels_uploader_id FOREIGN KEY (uploader_id) REFERENCES channels(uploader_id),
|
||||||
|
INDEX videos_id_idx (id ASC),
|
||||||
|
INDEX video_uploaded_idx (uploaded ASC) USING HASH,
|
||||||
|
INDEX video_uploader_id_idx (uploader_id ASC) STORING (duration, thumbnail, title, uploaded, views, is_short),
|
||||||
|
UNIQUE INDEX videos_id_key (id ASC) STORING (duration, thumbnail, title, uploaded, views, is_short)
|
||||||
|
);
|
||||||
|
|
||||||
|
--rollback DROP TABLE IF EXISTS videos;
|
||||||
|
@ -1,3 +1,22 @@
|
|||||||
CREATE INDEX IF NOT EXISTS users_session_id_idx ON users (session_id ASC);
|
CREATE INDEX IF NOT EXISTS users_session_id_idx ON users (session_id ASC);
|
||||||
|
|
||||||
--rollback DROP INDEX IF EXISTS users_session_id_idx;
|
--rollback DROP INDEX IF EXISTS users_session_id_idx;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS videos (
|
||||||
|
id VARCHAR(16) NOT NULL UNIQUE,
|
||||||
|
duration INT8 NULL,
|
||||||
|
thumbnail VARCHAR(400) NULL,
|
||||||
|
title VARCHAR(120) NULL,
|
||||||
|
uploaded INT8 NULL,
|
||||||
|
views INT8 NULL,
|
||||||
|
uploader_id VARCHAR(24) NOT NULL,
|
||||||
|
is_short BOOL NOT NULL DEFAULT false,
|
||||||
|
CONSTRAINT videos_pkey PRIMARY KEY (id, uploader_id),
|
||||||
|
CONSTRAINT fk_videos_channels_uploader_id FOREIGN KEY (uploader_id) REFERENCES channels(uploader_id)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE UNIQUE INDEX IF NOT EXISTS videos_id_idx ON videos (id ASC);
|
||||||
|
CREATE INDEX IF NOT EXISTS video_uploaded_idx ON videos (uploaded ASC);
|
||||||
|
CREATE INDEX IF NOT EXISTS video_uploader_id_idx ON videos (uploader_id ASC);
|
||||||
|
|
||||||
|
--rollback DROP TABLE IF EXISTS videos;
|
||||||
|
@ -10,7 +10,6 @@ DROP INDEX IF EXISTS users_id_idx;
|
|||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS username_idx ON users (username ASC);
|
CREATE INDEX IF NOT EXISTS username_idx ON users (username ASC);
|
||||||
|
|
||||||
--rollback DROP INDEX IF EXISTS username_idx;
|
|
||||||
--rollback DROP TABLE IF EXISTS users;
|
--rollback DROP TABLE IF EXISTS users;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS channels (
|
CREATE TABLE IF NOT EXISTS channels (
|
||||||
@ -23,5 +22,4 @@ CREATE TABLE IF NOT EXISTS channels (
|
|||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS channels_uploader_idx ON channels (uploader ASC);
|
CREATE INDEX IF NOT EXISTS channels_uploader_idx ON channels (uploader ASC);
|
||||||
|
|
||||||
--rollback DROP INDEX IF EXISTS channels_uploader_idx;
|
|
||||||
--rollback DROP TABLE IF EXISTS channels;
|
--rollback DROP TABLE IF EXISTS channels;
|
||||||
|
Loading…
Reference in New Issue
Block a user