Skip to content

Commit acc825b

Browse files
authored
perf: Add trigram index for doc title search (outline#8454)
1 parent bef4292 commit acc825b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
'use strict';
2+
3+
/** @type {import('sequelize-cli').Migration} */
4+
module.exports = {
5+
async up (queryInterface) {
6+
await queryInterface.sequelize.query(
7+
`CREATE EXTENSION IF NOT EXISTS "pg_trgm";`,
8+
);
9+
await queryInterface.sequelize.query(
10+
`CREATE INDEX CONCURRENTLY documents_title_idx ON documents USING GIN (title gin_trgm_ops);`,
11+
);
12+
},
13+
14+
async down (queryInterface) {
15+
await queryInterface.sequelize.query(
16+
`DROP INDEX CONCURRENTLY documents_title_idx;`,
17+
);
18+
}
19+
};

0 commit comments

Comments
 (0)