From b3c06354f7e5cfc6e3b4c6955ea5941aa8d97473 Mon Sep 17 00:00:00 2001 From: Kavin <20838718+FireMasterK@users.noreply.github.com> Date: Mon, 14 Aug 2023 08:43:07 +0100 Subject: [PATCH] Add pubsub table. --- src/main/resources/changelog/version/0-1-init-crdb.sql | 4 ++++ src/main/resources/changelog/version/0-1-init-pg.sql | 4 ++++ src/main/resources/changelog/version/0-1-init.sql | 10 ++++++++++ 3 files changed, 18 insertions(+) diff --git a/src/main/resources/changelog/version/0-1-init-crdb.sql b/src/main/resources/changelog/version/0-1-init-crdb.sql index 395cf02..2f2d037 100644 --- a/src/main/resources/changelog/version/0-1-init-crdb.sql +++ b/src/main/resources/changelog/version/0-1-init-crdb.sql @@ -31,3 +31,7 @@ CREATE TABLE IF NOT EXISTS users_subscribed ( ); --rollback DROP TABLE IF EXISTS users_subscribed; + +CREATE INDEX IF NOT EXISTS pubsub_subbed_at_idx ON pubsub (subbed_at ASC) USING HASH; + +--rollback DROP INDEX IF EXISTS pubsub_subbed_at_idx; diff --git a/src/main/resources/changelog/version/0-1-init-pg.sql b/src/main/resources/changelog/version/0-1-init-pg.sql index 8362d82..7694b7b 100644 --- a/src/main/resources/changelog/version/0-1-init-pg.sql +++ b/src/main/resources/changelog/version/0-1-init-pg.sql @@ -32,3 +32,7 @@ CREATE INDEX IF NOT EXISTS users_subscribed_subscriber_idx ON users_subscribed ( CREATE INDEX IF NOT EXISTS users_subscribed_channel_idx ON users_subscribed (channel ASC); --rollback DROP TABLE IF EXISTS users_subscribed; + +CREATE INDEX IF NOT EXISTS pubsub_subbed_at_idx ON pubsub (subbed_at ASC); + +--rollback DROP INDEX IF EXISTS pubsub_subbed_at_idx; diff --git a/src/main/resources/changelog/version/0-1-init.sql b/src/main/resources/changelog/version/0-1-init.sql index 126e42f..8caa6e1 100644 --- a/src/main/resources/changelog/version/0-1-init.sql +++ b/src/main/resources/changelog/version/0-1-init.sql @@ -23,3 +23,13 @@ CREATE TABLE IF NOT EXISTS channels ( CREATE INDEX IF NOT EXISTS channels_uploader_idx ON channels (uploader ASC); --rollback DROP TABLE IF EXISTS channels; + +CREATE TABLE IF NOT EXISTS pubsub ( + id VARCHAR(24) NOT NULL, + subbed_at INT8 NULL, + CONSTRAINT pubsub_pkey PRIMARY KEY (id) +); + +CREATE INDEX IF NOT EXISTS pubsub_id_idx ON pubsub (id ASC); + +--rollback DROP TABLE IF EXISTS pubsub;