traxxx/migrations/20240414003818_alerts_any.js

39 lines
769 B
JavaScript
Raw Normal View History

2024-04-29 01:53:17 +00:00
exports.up = async (knex) => {
await knex.schema.alterTable('alerts', (table) => {
table.boolean('all_actors')
.notNullable()
.defaultTo(true);
table.boolean('all_entities')
.notNullable()
.defaultTo(true);
table.boolean('all_tags')
.notNullable()
.defaultTo(true);
table.boolean('all_matches')
.notNullable()
.defaultTo(true);
});
2024-05-20 04:29:44 +00:00
await knex.raw(`
UPDATE alerts
SET
all_actors = false,
all_entities = false,
all_tags = false,
all_matches= false
WHERE alerts.all = false;
`);
2024-04-29 01:53:17 +00:00
};
exports.down = async (knex) => {
await knex.schema.alterTable('alerts', (table) => {
table.dropColumn('all_actors');
table.dropColumn('all_entities');
table.dropColumn('all_tags');
table.dropColumn('all_matches');
});
};