Add compilations to DB

This commit is contained in:
broquemonsieur 2023-06-14 22:53:02 -07:00
parent 24f55a7876
commit bef234fd74
3 changed files with 8 additions and 19 deletions

View File

@ -1,19 +1,8 @@
-- Type: public.privacy -- Table: public.compilations
-- DROP TYPE public.privacy; -- DROP TABLE public.compilations;
CREATE TYPE public.privacy AS ENUM CREATE TABLE IF NOT EXISTS public.compilations
(
'Public',
'Unlisted',
'Private'
);
-- Table: public.playlists
-- DROP TABLE public.playlists;
CREATE TABLE IF NOT EXISTS public.playlists
( (
title text, title text,
id text primary key, id text primary key,

View File

@ -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/annotations.sql
psql --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" < config/sql/playlists.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/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

View File

@ -3,7 +3,7 @@ require "./base.cr"
# #
# This module contains functions related to the "playlists" table. # This module contains functions related to the "playlists" table.
# #
module Invidious::Database::Playlists module Invidious::Database::Compilations
extend self extend self
# ------------------- # -------------------
@ -173,16 +173,14 @@ end
# #
# This module contains functions related to the "playlist_videos" table. # This module contains functions related to the "playlist_videos" table.
# #
module Invidious::Database::PlaylistVideos module Invidious::Database::CompilationVideos
extend self extend self
private alias VideoIndex = Int64 | Array(Int64)
# ------------------- # -------------------
# Insert / Delete # Insert / Delete
# ------------------- # -------------------
def insert(video : PlaylistVideo) def insert(video : CompilationVideo)
video_array = video.to_a video_array = video.to_a
request = <<-SQL request = <<-SQL