Sfoglia il codice sorgente

GC-2046: fix mogration file init-serverurl

Yuki Takei 7 anni fa
parent
commit
09001d33b9
1 ha cambiato i file con 7 aggiunte e 1 eliminazioni
  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');
     }
   },