You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@unomi.apache.org by sh...@apache.org on 2021/10/12 12:49:24 UTC

[unomi] 01/01: Fix bug in migration

This is an automated email from the ASF dual-hosted git repository.

shuber pushed a commit to branch UNOMI-516-migration-bug
in repository https://gitbox.apache.org/repos/asf/unomi.git

commit 89eef2893417d69ea06f7f160209607824e69be5
Author: Serge Huber <sh...@jahia.com>
AuthorDate: Tue Oct 12 14:49:17 2021 +0200

    Fix bug in migration
---
 .../java/org/apache/unomi/shell/migration/impl/MigrationTo150.java  | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/shell-commands/src/main/java/org/apache/unomi/shell/migration/impl/MigrationTo150.java b/tools/shell-commands/src/main/java/org/apache/unomi/shell/migration/impl/MigrationTo150.java
index 03c377e..54da2f5 100644
--- a/tools/shell-commands/src/main/java/org/apache/unomi/shell/migration/impl/MigrationTo150.java
+++ b/tools/shell-commands/src/main/java/org/apache/unomi/shell/migration/impl/MigrationTo150.java
@@ -259,7 +259,11 @@ public class MigrationTo150 implements Migration {
             mappings.put("dynamic_templates", newTypeMappings.getJSONArray("dynamic_templates"));
         }
         if (newTypeMappings.has("properties")) {
-            mappings.put("properties", getMergedPropertyMappings(mappings.getJSONObject("properties"), newTypeMappings.getJSONObject("properties")));
+            if (mappings.has("properties")) {
+                mappings.put("properties", getMergedPropertyMappings(mappings.getJSONObject("properties"), newTypeMappings.getJSONObject("properties")));
+            } else {
+                mappings.put("properties", newTypeMappings.getJSONObject("properties"));
+            }
         }
         return new JSONObject().put("mappings", mappings);
     }