Compare commits
2
Commits
ec307112a9
...
cf8f1a0f7b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf8f1a0f7b | ||
|
|
1efa4715d7 |
@@ -0,0 +1,38 @@
|
||||
exports.up = async function(knex) {
|
||||
await knex.raw(`
|
||||
DROP MATERIALIZED VIEW stashes_meta;
|
||||
|
||||
CREATE MATERIALIZED VIEW stashes_meta AS (
|
||||
SELECT
|
||||
stashes.id as stash_id,
|
||||
COUNT(DISTINCT stashes_scenes)::integer as stashed_scenes,
|
||||
COUNT(DISTINCT stashes_movies)::integer as stashed_movies,
|
||||
COUNT(DISTINCT stashes_actors)::integer as stashed_actors,
|
||||
MAX(GREATEST(stashes_scenes.created_at, stashes_movies.created_at, stashes_actors.created_at)) as stashed_last
|
||||
FROM stashes
|
||||
LEFT JOIN stashes_scenes ON stashes_scenes.stash_id = stashes.id
|
||||
LEFT JOIN stashes_movies ON stashes_movies.stash_id = stashes.id
|
||||
LEFT JOIN stashes_actors ON stashes_actors.stash_id = stashes.id
|
||||
GROUP BY stashes.id
|
||||
);
|
||||
`);
|
||||
};
|
||||
|
||||
exports.down = async function(knex) {
|
||||
await knex.raw(`
|
||||
DROP MATERIALIZED VIEW stashes_meta;
|
||||
|
||||
CREATE MATERIALIZED VIEW stashes_meta AS (
|
||||
SELECT
|
||||
stashes.id as stash_id,
|
||||
COUNT(DISTINCT stashes_scenes)::integer as stashed_scenes,
|
||||
COUNT(DISTINCT stashes_movies)::integer as stashed_movies,
|
||||
COUNT(DISTINCT stashes_actors)::integer as stashed_actors
|
||||
FROM stashes
|
||||
LEFT JOIN stashes_scenes ON stashes_scenes.stash_id = stashes.id
|
||||
LEFT JOIN stashes_movies ON stashes_movies.stash_id = stashes.id
|
||||
LEFT JOIN stashes_actors ON stashes_actors.stash_id = stashes.id
|
||||
GROUP BY stashes.id
|
||||
);
|
||||
`);
|
||||
};
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "traxxx",
|
||||
"version": "1.255.5",
|
||||
"version": "1.255.6",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "traxxx",
|
||||
"version": "1.255.5",
|
||||
"version": "1.255.6",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-s3": "^3.458.0",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "traxxx",
|
||||
"version": "1.255.5",
|
||||
"version": "1.255.6",
|
||||
"description": "All the latest porn releases in one place",
|
||||
"main": "src/app.js",
|
||||
"scripts": {
|
||||
|
||||
Reference in New Issue
Block a user