diff --git a/config/sql/compilations.sql b/config/sql/compilations.sql index ccf04c30..4076e1b8 100644 --- a/config/sql/compilations.sql +++ b/config/sql/compilations.sql @@ -1,19 +1,8 @@ --- Type: public.privacy +-- Table: public.compilations --- DROP TYPE public.privacy; +-- DROP TABLE public.compilations; -CREATE TYPE public.privacy AS ENUM -( - 'Public', - 'Unlisted', - 'Private' -); - --- Table: public.playlists - --- DROP TABLE public.playlists; - -CREATE TABLE IF NOT EXISTS public.playlists +CREATE TABLE IF NOT EXISTS public.compilations ( title text, id text primary key, diff --git a/docker/init-invidious-db.sh b/docker/init-invidious-db.sh index 22b4cc5f..f7fe3e7f 100755 --- a/docker/init-invidious-db.sh +++ b/docker/init-invidious-db.sh @@ -10,3 +10,5 @@ psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/nonces.sql psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/annotations.sql psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/playlists.sql psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/playlist_videos.sql +psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/compilations.sql +psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/compilation_videos.sql diff --git a/src/invidious/database/compilations.cr b/src/invidious/database/compilations.cr index c6754a1e..80672abf 100644 --- a/src/invidious/database/compilations.cr +++ b/src/invidious/database/compilations.cr @@ -3,7 +3,7 @@ require "./base.cr" # # This module contains functions related to the "playlists" table. # -module Invidious::Database::Playlists +module Invidious::Database::Compilations extend self # ------------------- @@ -173,16 +173,14 @@ end # # This module contains functions related to the "playlist_videos" table. # -module Invidious::Database::PlaylistVideos +module Invidious::Database::CompilationVideos extend self - private alias VideoIndex = Int64 | Array(Int64) - # ------------------- # Insert / Delete # ------------------- - def insert(video : PlaylistVideo) + def insert(video : CompilationVideo) video_array = video.to_a request = <<-SQL