Added alert filter migration.

This commit is contained in:
DebaucheryLibrarian
2026-11-28 07:04:06 +01:00
parent a464ad6ace
commit cde9dfd027
3 changed files with 45 additions and 9 deletions
@@ -0,0 +1,44 @@
// the third stage of an alert: after the alert matched a scene, a filter stops the notification, like the global tag filter does for browsing
// one table for every kind of filter, each row filters exactly one tag, entity or actor
exports.up = async function(knex) {
await knex.schema.createTable('alerts_filters', (table) => {
table.increments('id');
table.integer('alert_id')
.notNullable()
.references('id')
.inTable('alerts')
.onDelete('cascade');
table.integer('tag_id')
.references('id')
.inTable('tags')
.onDelete('cascade');
// entity and actor filters aren't used yet, they're here so new kinds don't need another table
table.integer('entity_id')
.references('id')
.inTable('entities')
.onDelete('cascade');
table.integer('actor_id')
.references('id')
.inTable('actors')
.onDelete('cascade');
table.check('num_nonnulls(tag_id, entity_id, actor_id) = 1', [], 'alerts_filters_one_target');
// nulls are distinct, so these only apply to rows of their own kind
table.unique(['alert_id', 'tag_id']);
table.unique(['alert_id', 'entity_id']);
table.unique(['alert_id', 'actor_id']);
table.datetime('created_at')
.notNullable()
.defaultTo(knex.fn.now());
});
};
exports.down = async function(knex) {
await knex.schema.dropTable('alerts_filters');
};
-9
View File
@@ -7692,15 +7692,6 @@ const sites = [
delete: true, delete: true,
parent: 'mamacitaz', parent: 'mamacitaz',
}, },
// MANYVIDS
{
name: 'nicoledoshi',
slug: 'mv.nicoledoshi',
url: 'https://nicoledoshi.manyvids.com',
hasLogo: false,
parent: 'manyvids',
delete: true,
},
// MARISKA X // MARISKA X
{ {
name: 'MariskaX', name: 'MariskaX',
+1
View File
@@ -49,6 +49,7 @@ exports.seed = async function (knex) {
url: channel.url, url: channel.url,
parent_id: manyvidsNetwork.id, parent_id: manyvidsNetwork.id,
has_logo: false, has_logo: false,
showcased: null,
}))) })))
.onConflict(['slug', 'type']) .onConflict(['slug', 'type'])
.merge(['name', 'url']) .merge(['name', 'url'])