Yuki Takei пре 4 година
родитељ
комит
a548088586

+ 11 - 0
packages/app/src/migrations/20220311011114-convert-page-delete-config.js

@@ -16,6 +16,17 @@ module.exports = {
     mongoose.connect(getMongoUri(), mongoOptions);
     const Config = getModelSafely('Config') || ConfigModel;
 
+    const isNewConfigExists = await Config.count({
+      ns: 'crowi',
+      key: 'security:pageDeletionAuthority',
+    }) > 0;
+
+    if (isNewConfigExists) {
+      logger.info('This migration is skipped because new configs are existed.');
+      logger.info('Migration has successfully applied');
+      return;
+    }
+
     const oldConfig = await Config.findOne({
       ns: 'crowi',
       key: 'security:pageCompleteDeletionAuthority',