Merge branch 'pull/723' into development

# Conflicts:
#	mvis/ivis-core
This commit is contained in:
Tomas Bures 2019-12-07 13:56:49 +01:00
commit 3c4fbf2754
8 changed files with 21 additions and 3 deletions

View file

@ -195,6 +195,7 @@ async function create(context, entity) {
' `latest_open` timestamp NULL DEFAULT NULL,\n' +
' `latest_click` timestamp NULL DEFAULT NULL,\n' +
' `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n' +
' `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n' +
' PRIMARY KEY (`id`),\n' +
' UNIQUE KEY `hash_email` (`hash_email`),\n' +
' UNIQUE KEY `cid` (`cid`),\n' +
@ -204,7 +205,8 @@ async function create(context, entity) {
' KEY `is_test` (`is_test`),\n' +
' KEY `latest_open` (`latest_open`),\n' +
' KEY `latest_click` (`latest_click`),\n' +
' KEY `created` (`created`)\n' +
' KEY `created` (`created`),\n' +
' KEY `updated` (`updated`)\n' +
') ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;\n');
await shares.rebuildPermissionsTx(tx, { entityTypeId: 'list', entityId: id });

View file

@ -616,6 +616,7 @@ async function _update(tx, listId, groupedFieldsMap, existing, filteredEntity) {
}
if (filteredEntity) {
filteredEntity.updated = new Date();
await tx(getSubscriptionTableName(listId)).where('id', existing.id).update(filteredEntity);
if ('status' in filteredEntity) {

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() => {
})();