From 0c53936d61df77e87adeca828ace02ddccc3f631 Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Mon, 1 May 2017 13:50:49 +0300 Subject: [PATCH] fix #1123, fix #1122 --- .../data_store/realm/schemas/account/v6/command.cljs | 4 ++-- .../data_store/realm/schemas/account/v6/contact.cljs | 12 +++++++++++- .../data_store/realm/schemas/account/v6/core.cljs | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/status_im/data_store/realm/schemas/account/v6/command.cljs b/src/status_im/data_store/realm/schemas/account/v6/command.cljs index a8ee573671..6cf95d16dc 100644 --- a/src/status_im/data_store/realm/schemas/account/v6/command.cljs +++ b/src/status_im/data_store/realm/schemas/account/v6/command.cljs @@ -18,5 +18,5 @@ :suggestions-trigger {:type :string :default "on-change"}}}) -(defn migration [_ _] - (log/debug "migrating chat-contact schema")) +(defn migration [old-realm new-realm] + (log/debug "migrating chat-contact schema v6")) diff --git a/src/status_im/data_store/realm/schemas/account/v6/contact.cljs b/src/status_im/data_store/realm/schemas/account/v6/contact.cljs index cff3d69b0c..543e2c15ac 100644 --- a/src/status_im/data_store/realm/schemas/account/v6/contact.cljs +++ b/src/status_im/data_store/realm/schemas/account/v6/contact.cljs @@ -29,4 +29,14 @@ :default false}}}) (defn migration [old-realm new-realm] - (log/debug "migrating contact schema v6")) + (log/debug "migrating contact schema v6") + (let [new-contacts (.objects new-realm "contact")] + (dotimes [i (.-length new-contacts)] + (let [contact (aget new-contacts i) + id (aget contact "whisper-identity")] + (when (= id "console") + (log/debug (js->clj contact)) + (aset contact "dapp-url" nil) + (aset contact "bot-url" "local://console-bot")) + (when (= id "wallet") + (aset contact "dapp-url" "https://status.im/dapps/wallet/")))))) diff --git a/src/status_im/data_store/realm/schemas/account/v6/core.cljs b/src/status_im/data_store/realm/schemas/account/v6/core.cljs index e6739bc979..1ae327df58 100644 --- a/src/status_im/data_store/realm/schemas/account/v6/core.cljs +++ b/src/status_im/data_store/realm/schemas/account/v6/core.cljs @@ -33,6 +33,6 @@ group-contact/schema]) (defn migration [old-realm new-realm] - (log/debug "migrating v5 account database: " old-realm new-realm) + (log/debug "migrating v6 account database: " old-realm new-realm) (chat/migration old-realm new-realm) (contact/migration old-realm new-realm))