forked from DebaucheryLibrarian/traxxx
Improved showcase query.
This commit is contained in:
@@ -3,10 +3,12 @@ const config = require('config');
|
||||
exports.up = async (knex) => knex.raw(`
|
||||
CREATE VIEW releases_not_showcased AS (
|
||||
SELECT releases.id AS release_id FROM releases
|
||||
LEFT JOIN entities ON entities.id = releases.entity_id
|
||||
LEFT JOIN entities AS channels ON channels.id = releases.entity_id
|
||||
LEFT JOIN entities AS studios ON studios.id = releases.studio_id
|
||||
WHERE entities.showcased = false
|
||||
OR studios.showcased = false
|
||||
LEFT JOIN entities AS networks ON networks .id = entities.parent_id
|
||||
WHERE (studios.showcased = false)
|
||||
OR (channel.showcased = false AND studios.showcased IS NOT true)
|
||||
OR (network.showcased = false AND channel.showcased IS NOT true AND studios.showcased IS NOT true)
|
||||
);
|
||||
|
||||
COMMENT ON VIEW releases_not_showcased IS E'@foreignKey (release_id) references releases (id)';
|
||||
|
||||
Reference in New Issue
Block a user