Added alert filter migration.
This commit is contained in:
@@ -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');
|
||||
};
|
||||
@@ -7692,15 +7692,6 @@ const sites = [
|
||||
delete: true,
|
||||
parent: 'mamacitaz',
|
||||
},
|
||||
// MANYVIDS
|
||||
{
|
||||
name: 'nicoledoshi',
|
||||
slug: 'mv.nicoledoshi',
|
||||
url: 'https://nicoledoshi.manyvids.com',
|
||||
hasLogo: false,
|
||||
parent: 'manyvids',
|
||||
delete: true,
|
||||
},
|
||||
// MARISKA X
|
||||
{
|
||||
name: 'MariskaX',
|
||||
|
||||
@@ -49,6 +49,7 @@ exports.seed = async function (knex) {
|
||||
url: channel.url,
|
||||
parent_id: manyvidsNetwork.id,
|
||||
has_logo: false,
|
||||
showcased: null,
|
||||
})))
|
||||
.onConflict(['slug', 'type'])
|
||||
.merge(['name', 'url'])
|
||||
|
||||
Reference in New Issue
Block a user