From 657e63332e014e0c4292e77499c59eb0dfd039a7 Mon Sep 17 00:00:00 2001 From: Kavin <20838718+FireMasterK@users.noreply.github.com> Date: Mon, 14 Aug 2023 09:30:53 +0100 Subject: [PATCH] Add unauthenticated_subscriptions table. --- .../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 | 11 +++++++++++ 3 files changed, 19 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 6dc280c..20b5879 100644 --- a/src/main/resources/changelog/version/0-1-init-crdb.sql +++ b/src/main/resources/changelog/version/0-1-init-crdb.sql @@ -41,3 +41,7 @@ CREATE INDEX IF NOT EXISTS playlists_owner_idx ON playlists (owner ASC) STORING --rollback DROP INDEX IF EXISTS playlists_playlist_id_idx; --rollback DROP INDEX IF EXISTS playlists_owner_idx; + +CREATE INDEX IF NOT EXISTS unauthenticated_subscriptions_id_idx ON unauthenticated_subscriptions (id ASC) USING HASH STORING (subscribed_at); + +--rollback DROP INDEX IF EXISTS unauthenticated_subscriptions_id_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 2b4499f..1fc4351 100644 --- a/src/main/resources/changelog/version/0-1-init-pg.sql +++ b/src/main/resources/changelog/version/0-1-init-pg.sql @@ -42,3 +42,7 @@ CREATE INDEX IF NOT EXISTS playlists_owner_idx ON playlists (owner ASC); --rollback DROP INDEX IF EXISTS playlists_playlist_id_idx; --rollback DROP INDEX IF EXISTS playlists_owner_idx; + +CREATE INDEX IF NOT EXISTS unauthenticated_subscriptions_id_idx ON unauthenticated_subscriptions (id ASC); + +--rollback DROP INDEX IF EXISTS unauthenticated_subscriptions_id_idx; diff --git a/src/main/resources/changelog/version/0-1-init.sql b/src/main/resources/changelog/version/0-1-init.sql index ce2689e..0accbb9 100644 --- a/src/main/resources/changelog/version/0-1-init.sql +++ b/src/main/resources/changelog/version/0-1-init.sql @@ -74,3 +74,14 @@ CREATE TABLE IF NOT EXISTS playlists_videos_ids ( CREATE INDEX IF NOT EXISTS playlists_videos_ids_playlist_id_idx ON playlists_videos_ids (playlist_id ASC); --rollback DROP TABLE IF EXISTS playlists_videos_ids; + +CREATE TABLE IF NOT EXISTS unauthenticated_subscriptions ( + id VARCHAR(24) NOT NULL, + subscribed_at INT8 NOT NULL, + CONSTRAINT unauthenticated_subscriptions_pkey PRIMARY KEY (id), + CONSTRAINT fk_unauthenticated_subscriptions_id_channels FOREIGN KEY (id) REFERENCES channels(uploader_id) +); + +CREATE INDEX IF NOT EXISTS unauthenticated_subscriptions_subscribed_at_idx ON unauthenticated_subscriptions (subscribed_at ASC); + +--rollback DROP TABLE IF EXISTS unauthenticated_subscriptions;