Added entity scene count function.
This commit is contained in:
11
migrations/20220126132955_scene_counts.js
Normal file
11
migrations/20220126132955_scene_counts.js
Normal file
@@ -0,0 +1,11 @@
|
||||
exports.up = async (knex) => knex.raw(`
|
||||
CREATE OR REPLACE FUNCTION entities_scene_total(entity entities) RETURNS integer AS $$
|
||||
SELECT COUNT(id)
|
||||
FROM releases
|
||||
WHERE releases.entity_id = entity.id;
|
||||
$$ LANGUAGE SQL STABLE;
|
||||
`);
|
||||
|
||||
exports.down = async (knex) => knex.raw(`
|
||||
DROP FUNCTION IF EXISTS entities_scene_total;
|
||||
`);
|
||||
Reference in New Issue
Block a user