Showing actors, tags and date on movie tiles.
This commit is contained in:
@@ -958,6 +958,36 @@ exports.up = knex => Promise.resolve()
|
||||
END;
|
||||
$$ LANGUAGE SQL STABLE;
|
||||
|
||||
CREATE FUNCTION movies_actors(movie movies) RETURNS SETOF actors AS $$
|
||||
SELECT actors.*
|
||||
FROM movies_scenes
|
||||
LEFT JOIN
|
||||
releases ON releases.id = movies_scenes.scene_id
|
||||
LEFT JOIN
|
||||
releases_actors ON releases_actors.release_id = releases.id
|
||||
LEFT JOIN
|
||||
actors ON actors.id = releases_actors.actor_id
|
||||
WHERE movies_scenes.movie_id = movie.id
|
||||
AND actors.id IS NOT NULL
|
||||
GROUP BY actors.id
|
||||
ORDER BY actors.name, actors.gender
|
||||
$$ LANGUAGE SQL STABLE;
|
||||
|
||||
CREATE FUNCTION movies_tags(movie movies) RETURNS SETOF tags AS $$
|
||||
SELECT tags.*
|
||||
FROM movies_scenes
|
||||
LEFT JOIN
|
||||
releases ON releases.id = movies_scenes.scene_id
|
||||
LEFT JOIN
|
||||
releases_tags ON releases_tags.release_id = releases.id
|
||||
LEFT JOIN
|
||||
tags ON tags.id = releases_tags.tag_id
|
||||
WHERE movies_scenes.movie_id = movie.id
|
||||
AND tags.id IS NOT NULL
|
||||
GROUP BY tags.id
|
||||
ORDER BY tags.priority DESC
|
||||
$$ LANGUAGE SQL STABLE;
|
||||
|
||||
CREATE FUNCTION releases_is_new(release releases) RETURNS boolean AS $$
|
||||
SELECT EXISTS(SELECT true WHERE (SELECT id FROM batches ORDER BY created_at DESC LIMIT 1) = release.created_batch_id);
|
||||
$$ LANGUAGE sql STABLE;
|
||||
@@ -1038,6 +1068,9 @@ exports.down = (knex) => { // eslint-disable-line arrow-body-style
|
||||
DROP FUNCTION IF EXISTS actors_channels;
|
||||
DROP FUNCTION IF EXISTS actors_scenes;
|
||||
|
||||
DROP FUNCTION IF EXISTS movies_actors;
|
||||
DROP FUNCTION IF EXISTS movies_tags;
|
||||
|
||||
DROP TEXT SEARCH CONFIGURATION IF EXISTS traxxx;
|
||||
DROP TEXT SEARCH DICTIONARY IF EXISTS traxxx_dict;
|
||||
`);
|
||||
|
||||
Reference in New Issue
Block a user