From 81cdee6835bf1bdd87738014dc12fcc7ca02471e Mon Sep 17 00:00:00 2001 From: Paula Rinta-Harri Date: Tue, 9 Apr 2024 14:11:25 +0300 Subject: [PATCH 1/2] Add migration script for adding user_guid indexes --- .../1712659673740_add-user-guid-indexes.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 migrations/1712659673740_add-user-guid-indexes.js diff --git a/migrations/1712659673740_add-user-guid-indexes.js b/migrations/1712659673740_add-user-guid-indexes.js new file mode 100644 index 0000000..8bdfb11 --- /dev/null +++ b/migrations/1712659673740_add-user-guid-indexes.js @@ -0,0 +1,16 @@ +/* eslint-disable camelcase */ + +exports.shorthands = undefined + +exports.up = (pgm) => { + // Adding indexes + pgm.createIndex('completed_agegroup_entries', 'user_guid', { + ifNotExists: true, + }) + pgm.createIndex('favourite_tasks', 'user_guid', { ifNotExists: true }) + pgm.createIndex('notifications', 'user_guid', { ifNotExists: true }) + pgm.createIndex('task_entries', 'user_guid', { ifNotExists: true }) + pgm.createIndex('task_group_entries', 'user_guid', { ifNotExists: true }) +} + +exports.down = (pgm) => {} From accd0ae870ac674f8d987de71fa6e56d2c78b098 Mon Sep 17 00:00:00 2001 From: Paula Rinta-Harri Date: Tue, 9 Apr 2024 14:23:23 +0300 Subject: [PATCH 2/2] Add names for new indexes --- .../1712659673740_add-user-guid-indexes.js | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/migrations/1712659673740_add-user-guid-indexes.js b/migrations/1712659673740_add-user-guid-indexes.js index 8bdfb11..c982333 100644 --- a/migrations/1712659673740_add-user-guid-indexes.js +++ b/migrations/1712659673740_add-user-guid-indexes.js @@ -6,11 +6,24 @@ exports.up = (pgm) => { // Adding indexes pgm.createIndex('completed_agegroup_entries', 'user_guid', { ifNotExists: true, + name: completed_agegroup_entries_user_guid_idx, + }) + pgm.createIndex('favourite_tasks', 'user_guid', { + ifNotExists: true, + name: favourite_tasks_user_guid_idx, + }) + pgm.createIndex('notifications', 'user_guid', { + ifNotExists: true, + name: notifications_user_guid_idx, + }) + pgm.createIndex('task_entries', 'user_guid', { + ifNotExists: true, + name: task_entries_user_guid_idx, + }) + pgm.createIndex('task_group_entries', 'user_guid', { + ifNotExists: true, + name: task_group_entries_user_guid_idx, }) - pgm.createIndex('favourite_tasks', 'user_guid', { ifNotExists: true }) - pgm.createIndex('notifications', 'user_guid', { ifNotExists: true }) - pgm.createIndex('task_entries', 'user_guid', { ifNotExists: true }) - pgm.createIndex('task_group_entries', 'user_guid', { ifNotExists: true }) } exports.down = (pgm) => {}