Files
silo-server/migrations/141_episode_title_sort_index.up.sql
T

8 lines
348 B
SQL
Raw Normal View History

2026-05-27 10:11:58 -04:00
-- Episode library title browse. Matches episodeCatalogSelectBody's sort_key
-- expression so PostgreSQL can satisfy ORDER BY title from the episodes index.
CREATE INDEX IF NOT EXISTS idx_episodes_sort_key_content
ON public.episodes USING btree (
LOWER(COALESCE(NULLIF(BTRIM(title), ''), 'Episode ' || episode_number::text)),
content_id
);