Triggers ported. Not tested yet.

This commit is contained in:
Tomas Bures 2018-09-22 15:59:05 +02:00
parent 907d548e02
commit 92d28daa9e
7 changed files with 206 additions and 31 deletions

View file

@ -1054,6 +1054,11 @@ async function migrateAttachments(knex) {
}
async function migrateTriggers(knex) {
await knex.schema.table('queued', table => {
table.renameColumn('subscriber', 'subscription');
table.renameColumn('source', 'trigger');
});
await knex.schema.table('triggers', table => {
table.renameColumn('rule', 'entity');
table.renameColumn('column', 'event');
@ -1086,6 +1091,14 @@ async function migrateTriggers(knex) {
table.dropColumn('segment');
});
await knex.schema.raw('CREATE TABLE `trigger_messages` (\n' +
' `trigger` int(10) unsigned NOT NULL,\n' +
' `list` int(11) unsigned NOT NULL,\n' +
' `subscription` int(11) unsigned NOT NULL,\n' +
' `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n' +
' PRIMARY KEY (`trigger`, `list`,`subscription`)\n' +
') ENGINE=InnoDB DEFAULT CHARSET=utf8;\n');
await knex.schema.dropTableIfExists('trigger');
}