Added subscription changed trigger

Is very useful if some subscription data is updated by API and you want to trigger after that because segments (filters) have changed.
This commit is contained in:
Gernot Pansy 2019-10-10 12:35:57 +02:00
parent ed2655b78e
commit e2a69ef76d
8 changed files with 21 additions and 3 deletions

View file

@ -0,0 +1,10 @@
exports.up = (knex, Promise) => (async() => {
const lists = await knex('lists');
for (const list of lists) {
await knex.schema.raw('ALTER TABLE `subscription__' + list.id + '` ADD COLUMN `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP AFTER `created`');
await knex.schema.raw('CREATE INDEX updated ON `subscription__' + list.id + '` (`updated`)');
}
})();
exports.down = (knex, Promise) => (async() => {
})();