From b2e6c6c3ca7d3a34114ccf4137af7961affa4fe4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaakko=20M=C3=A4kel=C3=A4=20=28OrangIT=29?= Date: Wed, 22 May 2024 11:39:29 +0300 Subject: [PATCH] Add migration scripts for adding task_guid, taskgroup_guid and agegroup_guid indexes --- .../1715937269727_add-task-guid-indexes.js | 23 +++++++++++++++++++ ...715937269921_add-taskgroup-guid-indexes.js | 18 +++++++++++++++ ...1715945956654_add-agegroup-guid-indexes.js | 12 ++++++++++ 3 files changed, 53 insertions(+) create mode 100644 migrations/1715937269727_add-task-guid-indexes.js create mode 100644 migrations/1715937269921_add-taskgroup-guid-indexes.js create mode 100644 migrations/1715945956654_add-agegroup-guid-indexes.js diff --git a/migrations/1715937269727_add-task-guid-indexes.js b/migrations/1715937269727_add-task-guid-indexes.js new file mode 100644 index 0000000..5bf5072 --- /dev/null +++ b/migrations/1715937269727_add-task-guid-indexes.js @@ -0,0 +1,23 @@ +/* eslint-disable camelcase */ + +exports.shorthands = undefined + +exports.up = (pgm) => { + // Adding indexes + pgm.createIndex('favourite_tasks', 'task_guid', { + ifNotExists: true, + name: 'favourite_tasks_task_guid_idx', + }) + + pgm.createIndex('task_entries', 'task_guid', { + ifNotExists: true, + name: 'task_entries_task_guid_idx', + }) + + pgm.createIndex('task_entries_history', 'task_guid', { + ifNotExists: true, + name: 'task_entries_history_task_guid_idx', + }) +} + +exports.down = (pgm) => {} diff --git a/migrations/1715937269921_add-taskgroup-guid-indexes.js b/migrations/1715937269921_add-taskgroup-guid-indexes.js new file mode 100644 index 0000000..63af467 --- /dev/null +++ b/migrations/1715937269921_add-taskgroup-guid-indexes.js @@ -0,0 +1,18 @@ +/* eslint-disable camelcase */ + +exports.shorthands = undefined + +exports.up = (pgm) => { + pgm.createIndex('task_group_entries', 'taskgroup_guid', { + ifNotExists: true, + name: 'task_group_entries_taskgroup_guid_idx', + }) + + // task_group_entries_history + pgm.createIndex('task_group_entries_history', 'taskgroup_guid', { + ifNotExists: true, + name: 'task_group_entries_history_taskgroup_guid_idx', + }) +} + +exports.down = (pgm) => {} diff --git a/migrations/1715945956654_add-agegroup-guid-indexes.js b/migrations/1715945956654_add-agegroup-guid-indexes.js new file mode 100644 index 0000000..4b6912a --- /dev/null +++ b/migrations/1715945956654_add-agegroup-guid-indexes.js @@ -0,0 +1,12 @@ +/* eslint-disable camelcase */ + +exports.shorthands = undefined + +exports.up = (pgm) => { + pgm.createIndex('completed_agegroup_entries', 'agegroup_guid', { + ifNotExists: true, + name: 'completed_agegroup_entries_agegroup_guid_idx', + }) +} + +exports.down = (pgm) => {}