Skip to content

Commit

Permalink
Merge pull request #84 from partio-scout/slow-queries
Browse files Browse the repository at this point in the history
Add migration scripts for adding task_guid, taskgroup_guid and agegro…
  • Loading branch information
orangit-jaakko-makela authored May 27, 2024
2 parents 1609656 + b2e6c6c commit 9fb2d4e
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 0 deletions.
23 changes: 23 additions & 0 deletions migrations/1715937269727_add-task-guid-indexes.js
Original file line number Diff line number Diff line change
@@ -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) => {}
18 changes: 18 additions & 0 deletions migrations/1715937269921_add-taskgroup-guid-indexes.js
Original file line number Diff line number Diff line change
@@ -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) => {}
12 changes: 12 additions & 0 deletions migrations/1715945956654_add-agegroup-guid-indexes.js
Original file line number Diff line number Diff line change
@@ -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) => {}

0 comments on commit 9fb2d4e

Please sign in to comment.