1
0
Просмотр исходного кода

add missing text index for tasks

Aneurin Barker Snook 1 год назад
Родитель
Сommit
f589f0cac7
1 измененных файлов с 5 добавлено и 0 удалено
  1. 5 0
      src/task/model.ts

+ 5 - 0
src/task/model.ts

@@ -24,6 +24,11 @@ async function createTaskModel(ctx: Context) {
   /** Initialize the task collection. */
   async function init() {
     await ctx.db.createCollection('task')
+
+    const exists = await collection.indexExists('task_text')
+    if (!exists) {
+      await collection.createIndex({ description: 'text' }, { name: 'task_text' })
+    }
   }
 
   /**