Skip to content

Commit dfb26bc

Browse files
authored
chore: create index to speed up folder sync (#1018)
1 parent 22a0b13 commit dfb26bc

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
'use strict';
2+
3+
/** @type {import('sequelize-cli').Migration} */
4+
module.exports = {
5+
async up(queryInterface, Sequelize) {
6+
await queryInterface.sequelize.query(`
7+
CREATE INDEX CONCURRENTLY IF NOT EXISTS idx_folders_user_parent_updated
8+
ON folders (user_id, updated_at)
9+
WHERE parent_id IS NOT NULL;
10+
`);
11+
},
12+
13+
async down(queryInterface, Sequelize) {
14+
await queryInterface.sequelize.query(`
15+
DROP INDEX CONCURRENTLY IF EXISTS idx_folders_user_parent_updated;
16+
`);
17+
},
18+
};

0 commit comments

Comments
 (0)