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

[unomi] branch unomi-1.6.x updated: Fix bug in migration (#354)

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

jkevan pushed a commit to branch unomi-1.6.x
in repository https://gitbox.apache.org/repos/asf/unomi.git


The following commit(s) were added to refs/heads/unomi-1.6.x by this push:
     new 6b391b5  Fix bug in migration (#354)
6b391b5 is described below

commit 6b391b5bc182d48ac7ad3fdd716a45468aba07db
Author: Serge Huber <sh...@jahia.com>
AuthorDate: Mon Oct 18 14:44:01 2021 +0200

    Fix bug in migration (#354)
---
 .../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);
     }