Compare commits
2 Commits
a3a2de2e04
...
45acc9bf3c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
45acc9bf3c | ||
|
|
043b98fd49 |
29
migrations/20260713052703_scene_alerts.js
Normal file
29
migrations/20260713052703_scene_alerts.js
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
exports.up = async function(knex) {
|
||||||
|
await knex.schema.createMaterializedView('alerts_users_scenes', (view) => {
|
||||||
|
view.columns('user_id', 'scene_id', 'alert_ids');
|
||||||
|
|
||||||
|
view.as(
|
||||||
|
knex('alerts_scenes')
|
||||||
|
.select(
|
||||||
|
'alerts.user_id',
|
||||||
|
'alerts_scenes.scene_id',
|
||||||
|
knex.raw('array_agg(distinct alerts.id) as alert_ids'),
|
||||||
|
knex.raw('(alerts_tags.id is null and alerts_entities.id is null and alerts_matches.id is null and related_scenes.id is null) as is_only'),
|
||||||
|
)
|
||||||
|
.leftJoin('alerts', 'alerts.id', 'alerts_scenes.alert_id')
|
||||||
|
.leftJoin('alerts_entities', 'alerts_entities.alert_id', 'alerts_scenes.alert_id')
|
||||||
|
.leftJoin('alerts_tags', 'alerts_tags.alert_id', 'alerts_scenes.alert_id')
|
||||||
|
.leftJoin('alerts_matches', 'alerts_matches.alert_id', 'alerts_scenes.alert_id')
|
||||||
|
.leftJoin('alerts_scenes as related_scenes', (joinBuilder) => {
|
||||||
|
joinBuilder
|
||||||
|
.on('related_scenes.alert_id', 'alerts_scenes.alert_id')
|
||||||
|
.on('related_scenes.scene_id', '!=', 'alerts_scenes.scene_id');
|
||||||
|
})
|
||||||
|
.groupBy(['user_id', 'alerts_scenes.scene_id', 'is_only']),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.down = async function(knex) {
|
||||||
|
await knex.schema.dropView('alerts_users_scenes');
|
||||||
|
};
|
||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "traxxx",
|
"name": "traxxx",
|
||||||
"version": "1.254.15",
|
"version": "1.254.16",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "traxxx",
|
"name": "traxxx",
|
||||||
"version": "1.254.15",
|
"version": "1.254.16",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-s3": "^3.458.0",
|
"@aws-sdk/client-s3": "^3.458.0",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "traxxx",
|
"name": "traxxx",
|
||||||
"version": "1.254.15",
|
"version": "1.254.16",
|
||||||
"description": "All the latest porn releases in one place",
|
"description": "All the latest porn releases in one place",
|
||||||
"main": "src/app.js",
|
"main": "src/app.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user