Procházet zdrojové kódy

GC-2046: fix mogration file init-serverurl

Yuki Takei před 7 roky
rodič
revize
09001d33b9
1 změnil soubory, kde provedl 7 přidání a 1 odebrání
  1. 7 1
      src/migrations/20180927102719-init-serverurl.js

+ 7 - 1
src/migrations/20180927102719-init-serverurl.js

@@ -66,7 +66,13 @@ module.exports = {
     }
 
     if (siteUrl != null) {
-      await Config.findOneAndUpdateByNsAndKey('crowi', 'app:siteUrl', siteUrl);
+      const ns = 'crowi';
+      const key = 'app:siteUrl';
+      await Config.findOneAndUpdate(
+        { ns, key },
+        { ns, key, value: JSON.stringify(siteUrl) },
+        { upsert: true },
+      );
       logger.info('Migration has successfully applied');
     }
   },