Refactored alerts to use application code, added regex. Updated Jules Jordan for the Ass Factory relaunch.
This commit is contained in:
38
migrations/20231109011513_alert_andor_pattern.js
Normal file
38
migrations/20231109011513_alert_andor_pattern.js
Normal file
@@ -0,0 +1,38 @@
|
||||
const config = require('config');
|
||||
|
||||
exports.up = async (knex) => {
|
||||
await knex.schema.alterTable('alerts', (table) => {
|
||||
table.boolean('all')
|
||||
.defaultTo(true);
|
||||
});
|
||||
|
||||
await knex.schema.alterTable('alerts_entities', (table) => {
|
||||
table.dropUnique('alert_id');
|
||||
});
|
||||
|
||||
await knex.schema.createTable('alerts_matches', (table) => {
|
||||
table.increments('id');
|
||||
|
||||
table.integer('alert_id')
|
||||
.references('id')
|
||||
.inTable('alerts')
|
||||
.onDelete('cascade');
|
||||
|
||||
table.string('property');
|
||||
table.string('expression');
|
||||
});
|
||||
|
||||
await knex.raw(`
|
||||
GRANT SELECT ON alerts_matches TO :visitor;
|
||||
`, {
|
||||
visitor: knex.raw(config.database.query.user),
|
||||
});
|
||||
};
|
||||
|
||||
exports.down = async (knex) => {
|
||||
await knex.schema.alterTable('alerts', (table) => {
|
||||
table.dropColumn('all');
|
||||
});
|
||||
|
||||
await knex.schema.dropTable('alerts_matches');
|
||||
};
|
||||
Reference in New Issue
Block a user