25 lines
No EOL
526 B
Text
25 lines
No EOL
526 B
Text
CREATE OR REPLACE VIEW optimized_album_releases AS
|
|
SELECT
|
|
a.name AS title,
|
|
a.release_date,
|
|
a.release_link AS url,
|
|
a.total_plays,
|
|
CONCAT('/', df.filename_disk) AS image,
|
|
'album-release' AS type,
|
|
|
|
json_build_object(
|
|
'name', ar.name_string,
|
|
'url', ar.slug,
|
|
'description', ar.description
|
|
) AS artist,
|
|
|
|
EXTRACT(EPOCH FROM a.release_date) AS release_timestamp
|
|
|
|
FROM
|
|
albums a
|
|
LEFT JOIN
|
|
directus_files df ON a.art = df.id
|
|
LEFT JOIN
|
|
artists ar ON a.artist = ar.id
|
|
WHERE
|
|
a.release_date IS NOT NULL; |