mirror of
https://github.com/outline/outline.git
synced 2026-11-30 00:50:41 +03:00
perf: Add partial createdAt index for stuck import task scan (#14565)
This commit is contained in:
1 parent
d066c98bde
commit
e262f3bd17
1 file changed
+17
@@ -0,0 +1,17 @@
|
||||
"use strict";
|
||||
|
||||
/** @type {import('sequelize-cli').Migration} */
|
||||
module.exports = {
|
||||
async up(queryInterface) {
|
||||
// Covers the scan for stuck import tasks, which pages by createdAt.
|
||||
await queryInterface.sequelize.query(
|
||||
`CREATE INDEX CONCURRENTLY IF NOT EXISTS "import_tasks_pending_created_at" ON "import_tasks" ("createdAt", "id") WHERE "state" IN ('created', 'in_progress');`
|
||||
);
|
||||
},
|
||||
|
||||
async down(queryInterface) {
|
||||
await queryInterface.sequelize.query(
|
||||
'DROP INDEX CONCURRENTLY IF EXISTS "import_tasks_pending_created_at";'
|
||||
);
|
||||
},
|
||||
};
|
||||
Reference in new issue
Block a user