Explorar el Código

add missing text index for tasks

Aneurin Barker Snook hace 1 año
padre
commit
f589f0cac7
Se han modificado 1 ficheros con 5 adiciones y 0 borrados
  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' })
+    }
   }
 
   /**