Files
silo-server/migrations/055_metadata_localizations.up.sql
T

52 lines
1.7 KiB
SQL

ALTER TABLE media_items
ADD COLUMN default_metadata_language text NOT NULL DEFAULT 'en';
ALTER TABLE seasons
ADD COLUMN default_metadata_language text NOT NULL DEFAULT 'en';
ALTER TABLE episodes
ADD COLUMN default_metadata_language text NOT NULL DEFAULT 'en';
CREATE TABLE media_item_localizations (
content_id text NOT NULL REFERENCES media_items(content_id) ON DELETE CASCADE,
language text NOT NULL,
title text,
sort_title text,
overview text,
tagline text,
poster_path text,
poster_thumbhash text,
backdrop_path text,
backdrop_thumbhash text,
logo_path text,
created_at timestamp with time zone NOT NULL DEFAULT now(),
updated_at timestamp with time zone NOT NULL DEFAULT now(),
PRIMARY KEY (content_id, language)
);
CREATE TABLE season_localizations (
season_content_id text NOT NULL REFERENCES seasons(content_id) ON DELETE CASCADE,
language text NOT NULL,
title text,
overview text,
poster_path text,
poster_thumbhash text,
created_at timestamp with time zone NOT NULL DEFAULT now(),
updated_at timestamp with time zone NOT NULL DEFAULT now(),
PRIMARY KEY (season_content_id, language)
);
CREATE TABLE episode_localizations (
episode_content_id text NOT NULL REFERENCES episodes(content_id) ON DELETE CASCADE,
language text NOT NULL,
title text,
overview text,
created_at timestamp with time zone NOT NULL DEFAULT now(),
updated_at timestamp with time zone NOT NULL DEFAULT now(),
PRIMARY KEY (episode_content_id, language)
);
CREATE INDEX idx_media_item_localizations_language ON media_item_localizations(language);
CREATE INDEX idx_season_localizations_language ON season_localizations(language);
CREATE INDEX idx_episode_localizations_language ON episode_localizations(language);