forked from DebaucheryLibrarian/traxxx
Added movie support to MindGeek scraper.
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
exports.up = async (knex) => knex.raw(`
|
||||
CREATE VIEW movies_tagged AS
|
||||
SELECT * FROM movies;
|
||||
`);
|
||||
|
||||
exports.down = async (knex) => knex.raw(`
|
||||
DROP VIEW IF EXISTS movies_tagged;
|
||||
`);
|
||||
23
migrations/20220227215315_entity_filters.js
Normal file
23
migrations/20220227215315_entity_filters.js
Normal file
@@ -0,0 +1,23 @@
|
||||
exports.up = async (knex) => knex.raw(`
|
||||
CREATE FUNCTION entities_scene_tags(entity entities, selectable_tags text[]) RETURNS SETOF tags AS $$
|
||||
SELECT tags.*
|
||||
FROM releases
|
||||
LEFT JOIN
|
||||
releases_tags ON releases_tags.release_id = releases.id
|
||||
LEFT JOIN
|
||||
tags ON tags.id = releases_tags.tag_id
|
||||
WHERE
|
||||
releases.entity_id = entity.id
|
||||
AND
|
||||
CASE WHEN array_length(selectable_tags, 1) IS NOT NULL
|
||||
THEN tags.slug = ANY(selectable_tags)
|
||||
ELSE true
|
||||
END
|
||||
GROUP BY tags.id
|
||||
ORDER BY tags.name;
|
||||
$$ LANGUAGE SQL STABLE;
|
||||
`);
|
||||
|
||||
exports.down = async (knex) => knex.raw(`
|
||||
DROP FUNCTION IF EXISTS entities_tags;
|
||||
`);
|
||||
Reference in New Issue
Block a user