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

Create new projectId_1_threadId_1 index for rooms collection (#23422)

GitOrigin-RevId: 180799e5b045ba7f07e1dbda5b9d25b52741bd14
Domagoj Kriskovic 1 год назад
Родитель
Сommit
32bb4d36bb

+ 31 - 0
services/web/migrations/20250206103037_create_rooms_projectId_threadId_index.mjs

@@ -0,0 +1,31 @@
+/* eslint-disable no-unused-vars */
+
+import Helpers from './lib/helpers.mjs'
+
+const tags = ['server-ce', 'server-pro', 'saas']
+
+const indexes = [
+  {
+    key: {
+      project_id: 1,
+      thread_id: 1,
+    },
+    name: 'project_id_1_thread_id_1',
+  },
+]
+
+const migrate = async client => {
+  const { db } = client
+  await Helpers.addIndexesToCollection(db.rooms, indexes)
+}
+
+const rollback = async client => {
+  const { db } = client
+  await Helpers.dropIndexesFromCollection(db.rooms, indexes)
+}
+
+export default {
+  tags,
+  migrate,
+  rollback,
+}