Browse Source

Merge pull request #9770 from weseek/fix/migration-script-to-remove-index-for-ns-from-configs

fix: Migration script to remove index for 'ns' from config collection
mergify[bot] 1 year ago
parent
commit
63fa05020d

+ 12 - 0
apps/app/src/migrations/19700101000000-foremost-1000-20241123211930-remove-index-for-ns-from-configs.js

@@ -24,6 +24,18 @@ module.exports = {
     logger.info('Apply migration');
     logger.info('Apply migration');
     await mongoose.connect(getMongoUri(), mongoOptions);
     await mongoose.connect(getMongoUri(), mongoOptions);
 
 
+    // remove unnecessary data
+    // see: https://redmine.weseek.co.jp/issues/163527
+    await db.collection('configs').deleteMany({
+      ns: 'crowi',
+      key: {
+        $in: [
+          'notification:owner-page:isEnabled',
+          'notification:group-page:isEnabled',
+        ],
+      },
+    });
+
     // drop index
     // drop index
     await dropIndexIfExists(db, 'configs', 'ns_1_key_1');
     await dropIndexIfExists(db, 'configs', 'ns_1_key_1');