mirror of
https://github.com/TeamPiped/Piped-Backend.git
synced 2024-08-14 23:51:41 +00:00
Add users_subscribed table.
This commit is contained in:
parent
8c52d0eb28
commit
b0a97faf4f
2 changed files with 23 additions and 0 deletions
|
@ -20,3 +20,14 @@ CREATE TABLE IF NOT EXISTS videos (
|
|||
);
|
||||
|
||||
--rollback DROP TABLE IF EXISTS videos;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS users_subscribed (
|
||||
subscriber INT8 NOT NULL,
|
||||
channel VARCHAR(24) NOT NULL,
|
||||
CONSTRAINT users_subscribed_pkey PRIMARY KEY (subscriber ASC, channel ASC) USING HASH,
|
||||
CONSTRAINT fk_subscriber_users FOREIGN KEY (subscriber) REFERENCES users(id),
|
||||
INDEX users_subscribed_subscriber_idx (subscriber ASC),
|
||||
INDEX users_subscribed_channel_idx (channel ASC)
|
||||
);
|
||||
|
||||
--rollback DROP TABLE IF EXISTS users_subscribed;
|
||||
|
|
|
@ -20,3 +20,15 @@ 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;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS users_subscribed (
|
||||
subscriber INT8 NOT NULL,
|
||||
channel VARCHAR(24) NOT NULL,
|
||||
CONSTRAINT users_subscribed_pkey PRIMARY KEY (subscriber, channel),
|
||||
CONSTRAINT fk_subscriber_users FOREIGN KEY (subscriber) REFERENCES users(id)
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS users_subscribed_subscriber_idx ON users_subscribed (subscriber ASC);
|
||||
CREATE INDEX IF NOT EXISTS users_subscribed_channel_idx ON users_subscribed (channel ASC);
|
||||
|
||||
--rollback DROP TABLE IF EXISTS users_subscribed;
|
||||
|
|
Loading…
Reference in a new issue