From b8d250ba305e07e6b33f764b0073649cecf50672 Mon Sep 17 00:00:00 2001 From: yenda Date: Fri, 28 Sep 2018 11:49:27 +0200 Subject: [PATCH] change realm schemas directory layout the purpose of this change is to avoid the kind of mistakes that happened in the past were copy/pasting imports led to wrong migrations that went unnoticed it will also make it easier to do migrations in the future as the different versions of the same schemas are grouped together in the same file and past migrations are grouped in the same file as well so previous helper functions can be reused Signed-off-by: yenda --- .../realm/schemas/account/browser.cljs | 25 +++ .../realm/schemas/account/chat.cljs | 94 ++++++++ .../realm/schemas/account/contact.cljs | 27 +++ .../realm/schemas/account/core.cljs | 178 +++++++++++++--- .../schemas/account/dapp_permissions.cljs | 7 + .../realm/schemas/account/local_storage.cljs | 7 + .../realm/schemas/account/mailserver.cljs | 19 ++ .../realm/schemas/account/message.cljs | 53 +++++ .../realm/schemas/account/migrations.cljs | 68 ++++++ .../realm/schemas/account/request.cljs | 8 + .../realm/schemas/account/transport.cljs | 49 +++++ .../realm/schemas/account/user_status.cljs | 12 ++ .../realm/schemas/account/v1/browser.cljs | 13 -- .../realm/schemas/account/v1/chat.cljs | 32 --- .../schemas/account/v1/chat_contact.cljs | 7 - .../realm/schemas/account/v1/contact.cljs | 28 --- .../realm/schemas/account/v1/core.cljs | 22 -- .../schemas/account/v1/group_contact.cljs | 5 - .../schemas/account/v1/local_storage.cljs | 7 - .../realm/schemas/account/v1/message.cljs | 28 --- .../realm/schemas/account/v1/request.cljs | 8 - .../realm/schemas/account/v1/transport.cljs | 15 -- .../realm/schemas/account/v1/user_status.cljs | 12 -- .../realm/schemas/account/v10/core.cljs | 40 ---- .../realm/schemas/account/v11/core.cljs | 25 --- .../realm/schemas/account/v11/mailserver.cljs | 17 -- .../realm/schemas/account/v2/core.cljs | 24 --- .../realm/schemas/account/v2/mailserver.cljs | 11 - .../realm/schemas/account/v3/chat.cljs | 34 --- .../realm/schemas/account/v3/core.cljs | 24 --- .../realm/schemas/account/v4/core.cljs | 24 --- .../realm/schemas/account/v4/transport.cljs | 17 -- .../realm/schemas/account/v5/chat.cljs | 40 ---- .../realm/schemas/account/v5/core.cljs | 25 --- .../realm/schemas/account/v6/core.cljs | 24 --- .../realm/schemas/account/v6/transport.cljs | 19 -- .../realm/schemas/account/v7/core.cljs | 25 --- .../realm/schemas/account/v7/message.cljs | 33 --- .../realm/schemas/account/v8/browser.cljs | 25 --- .../realm/schemas/account/v8/core.cljs | 25 --- .../realm/schemas/account/v9/core.cljs | 26 --- .../schemas/account/v9/dapp_permissions.cljs | 7 - .../realm/schemas/base/account.cljs | 200 ++++++++++++++++++ .../realm/schemas/base/bootnode.cljs | 8 + .../data_store/realm/schemas/base/core.cljs | 96 ++++++--- .../realm/schemas/base/migrations.cljs | 89 ++++++++ .../realm/schemas/base/network.cljs | 11 + .../realm/schemas/base/v1/account.cljs | 25 --- .../realm/schemas/base/v1/core.cljs | 10 - .../realm/schemas/base/v1/network.cljs | 12 -- .../realm/schemas/base/v10/account.cljs | 30 --- .../realm/schemas/base/v10/core.cljs | 12 -- .../realm/schemas/base/v11/account.cljs | 22 -- .../realm/schemas/base/v11/core.cljs | 13 -- .../realm/schemas/base/v2/account.cljs | 26 --- .../realm/schemas/base/v2/core.cljs | 10 - .../realm/schemas/base/v3/account.cljs | 27 --- .../realm/schemas/base/v3/core.cljs | 10 - .../realm/schemas/base/v4/account.cljs | 29 --- .../realm/schemas/base/v4/bootnode.cljs | 8 - .../realm/schemas/base/v4/core.cljs | 12 -- .../realm/schemas/base/v5/account.cljs | 33 --- .../realm/schemas/base/v5/core.cljs | 13 -- .../realm/schemas/base/v6/account.cljs | 31 --- .../realm/schemas/base/v6/core.cljs | 12 -- .../realm/schemas/base/v7/account.cljs | 30 --- .../realm/schemas/base/v7/core.cljs | 12 -- .../realm/schemas/base/v8/account.cljs | 28 --- .../realm/schemas/base/v8/core.cljs | 13 -- .../realm/schemas/base/v9/account.cljs | 24 --- .../realm/schemas/base/v9/core.cljs | 13 -- 71 files changed, 883 insertions(+), 1165 deletions(-) create mode 100644 src/status_im/data_store/realm/schemas/account/browser.cljs create mode 100644 src/status_im/data_store/realm/schemas/account/chat.cljs create mode 100644 src/status_im/data_store/realm/schemas/account/contact.cljs create mode 100644 src/status_im/data_store/realm/schemas/account/dapp_permissions.cljs create mode 100644 src/status_im/data_store/realm/schemas/account/local_storage.cljs create mode 100644 src/status_im/data_store/realm/schemas/account/mailserver.cljs create mode 100644 src/status_im/data_store/realm/schemas/account/message.cljs create mode 100644 src/status_im/data_store/realm/schemas/account/migrations.cljs create mode 100644 src/status_im/data_store/realm/schemas/account/request.cljs create mode 100644 src/status_im/data_store/realm/schemas/account/transport.cljs create mode 100644 src/status_im/data_store/realm/schemas/account/user_status.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v1/browser.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v1/chat.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v1/chat_contact.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v1/contact.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v1/core.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v1/group_contact.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v1/local_storage.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v1/message.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v1/request.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v1/transport.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v1/user_status.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v10/core.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v11/core.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v11/mailserver.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v2/core.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v2/mailserver.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v3/chat.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v3/core.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v4/core.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v4/transport.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v5/chat.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v5/core.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v6/core.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v6/transport.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v7/core.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v7/message.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v8/browser.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v8/core.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v9/core.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v9/dapp_permissions.cljs create mode 100644 src/status_im/data_store/realm/schemas/base/account.cljs create mode 100644 src/status_im/data_store/realm/schemas/base/bootnode.cljs create mode 100644 src/status_im/data_store/realm/schemas/base/migrations.cljs create mode 100644 src/status_im/data_store/realm/schemas/base/network.cljs delete mode 100644 src/status_im/data_store/realm/schemas/base/v1/account.cljs delete mode 100644 src/status_im/data_store/realm/schemas/base/v1/core.cljs delete mode 100644 src/status_im/data_store/realm/schemas/base/v1/network.cljs delete mode 100644 src/status_im/data_store/realm/schemas/base/v10/account.cljs delete mode 100644 src/status_im/data_store/realm/schemas/base/v10/core.cljs delete mode 100644 src/status_im/data_store/realm/schemas/base/v11/account.cljs delete mode 100644 src/status_im/data_store/realm/schemas/base/v11/core.cljs delete mode 100644 src/status_im/data_store/realm/schemas/base/v2/account.cljs delete mode 100644 src/status_im/data_store/realm/schemas/base/v2/core.cljs delete mode 100644 src/status_im/data_store/realm/schemas/base/v3/account.cljs delete mode 100644 src/status_im/data_store/realm/schemas/base/v3/core.cljs delete mode 100644 src/status_im/data_store/realm/schemas/base/v4/account.cljs delete mode 100644 src/status_im/data_store/realm/schemas/base/v4/bootnode.cljs delete mode 100644 src/status_im/data_store/realm/schemas/base/v4/core.cljs delete mode 100644 src/status_im/data_store/realm/schemas/base/v5/account.cljs delete mode 100644 src/status_im/data_store/realm/schemas/base/v5/core.cljs delete mode 100644 src/status_im/data_store/realm/schemas/base/v6/account.cljs delete mode 100644 src/status_im/data_store/realm/schemas/base/v6/core.cljs delete mode 100644 src/status_im/data_store/realm/schemas/base/v7/account.cljs delete mode 100644 src/status_im/data_store/realm/schemas/base/v7/core.cljs delete mode 100644 src/status_im/data_store/realm/schemas/base/v8/account.cljs delete mode 100644 src/status_im/data_store/realm/schemas/base/v8/core.cljs delete mode 100644 src/status_im/data_store/realm/schemas/base/v9/account.cljs delete mode 100644 src/status_im/data_store/realm/schemas/base/v9/core.cljs diff --git a/src/status_im/data_store/realm/schemas/account/browser.cljs b/src/status_im/data_store/realm/schemas/account/browser.cljs new file mode 100644 index 0000000000..a1ded16aec --- /dev/null +++ b/src/status_im/data_store/realm/schemas/account/browser.cljs @@ -0,0 +1,25 @@ +(ns status-im.data-store.realm.schemas.account.browser) + +(def v1 {:name :browser + :primaryKey :browser-id + :properties {:browser-id :string + :name :string + :timestamp :int + :dapp? {:type :bool + :default false} + :url {:type :string + :optional true} + :contact {:type :string + :optional true}}}) + +(def v8 {:name :browser + :primaryKey :browser-id + :properties {:browser-id :string + :name :string + :timestamp :int + :dapp? {:type :bool + :default false} + :history-index {:type :int + :optional true} + :history {:type "string[]" + :optional true}}}) diff --git a/src/status_im/data_store/realm/schemas/account/chat.cljs b/src/status_im/data_store/realm/schemas/account/chat.cljs new file mode 100644 index 0000000000..720f656231 --- /dev/null +++ b/src/status_im/data_store/realm/schemas/account/chat.cljs @@ -0,0 +1,94 @@ +(ns status-im.data-store.realm.schemas.account.chat + (:require [status-im.ui.components.styles :refer [default-chat-color]])) + +(def v1 {:name :chat + :primaryKey :chat-id + :properties {:chat-id :string + :name :string + :color {:type :string + :default default-chat-color} + :group-chat {:type :bool + :indexed true} + :group-admin {:type :string + :optional true} + :is-active :bool + :timestamp :int + :contacts {:type "string[]"} + :removed-at {:type :int + :optional true} + :removed-from-at {:type :int + :optional true} + :added-to-at {:type :int + :optional true} + :updated-at {:type :int + :optional true} + :message-overhead {:type :int + :default 0} + :contact-info {:type :string + :optional true} + :debug? {:type :bool + :default false} + :public? {:type :bool + :default false}}}) + +(def v3 {:name :chat + :primaryKey :chat-id + :properties {:chat-id :string + :name :string + :color {:type :string + :default default-chat-color} + :group-chat {:type :bool + :indexed true} + :group-admin {:type :string + :optional true} + :is-active :bool + :timestamp :int + :contacts {:type "string[]"} + :removed-at {:type :int + :optional true} + :removed-from-at {:type :int + :optional true} + :deleted-at-clock-value {:type :int + :optional true} + :added-to-at {:type :int + :optional true} + :updated-at {:type :int + :optional true} + :message-overhead {:type :int + :default 0} + :contact-info {:type :string + :optional true} + :debug? {:type :bool + :default false} + :public? {:type :bool + :default false}}}) + +(def v5 {:name :chat + :primaryKey :chat-id + :properties {:chat-id :string + :name :string + :color {:type :string + :default default-chat-color} + :group-chat {:type :bool + :indexed true} + :group-admin {:type :string + :optional true} + :is-active :bool + :timestamp :int + :contacts {:type "string[]"} + :removed-at {:type :int + :optional true} + :removed-from-at {:type :int + :optional true} + :deleted-at-clock-value {:type :int + :optional true} + :added-to-at {:type :int + :optional true} + :updated-at {:type :int + :optional true} + :message-overhead {:type :int + :default 0} + :debug? {:type :bool + :default false} + :public? {:type :bool + :default false}}}) diff --git a/src/status_im/data_store/realm/schemas/account/contact.cljs b/src/status_im/data_store/realm/schemas/account/contact.cljs new file mode 100644 index 0000000000..55604f8b05 --- /dev/null +++ b/src/status_im/data_store/realm/schemas/account/contact.cljs @@ -0,0 +1,27 @@ +(ns status-im.data-store.realm.schemas.account.contact) + +(def v1 {:name :contact + :primaryKey :whisper-identity + :properties {:address {:type :string :optional true} + :whisper-identity :string + :name {:type :string :optional true} + :photo-path {:type :string :optional true} + :last-updated {:type :int :default 0} + :last-online {:type :int :default 0} + :pending? {:type :bool :default false} + :hide-contact? {:type :bool :default false} + :status {:type :string :optional true} + :fcm-token {:type :string :optional true} + :description {:type :string :optional true} + :public-key {:type :string + :optional true} + :dapp? {:type :bool + :default false} + :dapp-url {:type :string + :optional true} + :bot-url {:type :string + :optional true} + :dapp-hash {:type :int + :optional true} + :debug? {:type :bool + :default false}}}) diff --git a/src/status_im/data_store/realm/schemas/account/core.cljs b/src/status_im/data_store/realm/schemas/account/core.cljs index 206dd00c76..16739f2c5d 100644 --- a/src/status_im/data_store/realm/schemas/account/core.cljs +++ b/src/status_im/data_store/realm/schemas/account/core.cljs @@ -1,50 +1,158 @@ (ns status-im.data-store.realm.schemas.account.core - (:require - [status-im.data-store.realm.schemas.account.v1.core :as v1] - [status-im.data-store.realm.schemas.account.v2.core :as v2] - [status-im.data-store.realm.schemas.account.v3.core :as v3] - [status-im.data-store.realm.schemas.account.v4.core :as v4] - [status-im.data-store.realm.schemas.account.v5.core :as v5] - [status-im.data-store.realm.schemas.account.v6.core :as v6] - [status-im.data-store.realm.schemas.account.v7.core :as v7] - [status-im.data-store.realm.schemas.account.v8.core :as v8] - [status-im.data-store.realm.schemas.account.v9.core :as v9] - [status-im.data-store.realm.schemas.account.v10.core :as v10] - [status-im.data-store.realm.schemas.account.v11.core :as v11])) + (:require [status-im.data-store.realm.schemas.account.chat :as chat] + [status-im.data-store.realm.schemas.account.transport :as transport] + [status-im.data-store.realm.schemas.account.contact :as contact] + [status-im.data-store.realm.schemas.account.message :as message] + [status-im.data-store.realm.schemas.account.user-status :as user-status] + [status-im.data-store.realm.schemas.account.local-storage :as local-storage] + [status-im.data-store.realm.schemas.account.mailserver :as mailserver] + [status-im.data-store.realm.schemas.account.browser :as browser] + [status-im.data-store.realm.schemas.account.dapp-permissions :as dapp-permissions] + [status-im.data-store.realm.schemas.account.request :as request] + [status-im.data-store.realm.schemas.account.migrations :as migrations] + [taoensso.timbre :as log])) -;; TODO(oskarth): Add failing test if directory vXX exists but isn't in schemas. +(def v1 [chat/v1 + transport/v1 + contact/v1 + message/v1 + request/v1 + user-status/v1 + local-storage/v1 + browser/v1]) + +(def v2 [chat/v1 + transport/v1 + contact/v1 + message/v1 + request/v1 + mailserver/v2 + user-status/v1 + local-storage/v1 + browser/v1]) + +(def v3 [chat/v3 + transport/v1 + contact/v1 + message/v1 + request/v1 + mailserver/v2 + user-status/v1 + local-storage/v1 + browser/v1]) + +(def v4 [chat/v3 + transport/v4 + contact/v1 + message/v1 + request/v1 + mailserver/v2 + user-status/v1 + local-storage/v1 + browser/v1]) + +(def v5 [chat/v5 + transport/v4 + contact/v1 + message/v1 + request/v1 + mailserver/v2 + user-status/v1 + local-storage/v1 + browser/v1]) + +(def v6 [chat/v5 + transport/v6 + contact/v1 + message/v1 + request/v1 + mailserver/v2 + user-status/v1 + local-storage/v1 + browser/v1]) + +(def v7 [chat/v5 + transport/v6 + contact/v1 + message/v7 + request/v1 + mailserver/v2 + user-status/v1 + local-storage/v1 + browser/v1]) + +(def v8 [chat/v5 + transport/v6 + contact/v1 + message/v7 + request/v1 + mailserver/v2 + user-status/v1 + local-storage/v1 + browser/v8]) + +(def v9 [chat/v5 + transport/v6 + contact/v1 + message/v7 + request/v1 + mailserver/v2 + user-status/v1 + local-storage/v1 + browser/v8 + dapp-permissions/v9]) + +(def v10 [chat/v5 + transport/v6 + contact/v1 + message/v7 + mailserver/v2 + user-status/v1 + local-storage/v1 + browser/v8 + dapp-permissions/v9]) + +(def v11 [chat/v5 + transport/v6 + contact/v1 + message/v7 + mailserver/v11 + user-status/v1 + local-storage/v1 + browser/v8 + dapp-permissions/v9]) ;; put schemas ordered by version -(def schemas [{:schema v1/schema +(def schemas [{:schema v1 :schemaVersion 1 - :migration v1/migration} - {:schema v2/schema + :migration migrations/v1} + {:schema v2 :schemaVersion 2 - :migration v2/migration} - {:schema v3/schema + :migration migrations/v2} + {:schema v3 :schemaVersion 3 - :migration v3/migration} - {:schema v4/schema + :migration migrations/v3} + {:schema v4 :schemaVersion 4 - :migration v4/migration} - {:schema v5/schema + :migration migrations/v4} + {:schema v5 :schemaVersion 5 - :migration v5/migration} - {:schema v6/schema + :migration migrations/v5} + {:schema v6 :schemaVersion 6 - :migration v6/migration} - {:schema v7/schema + :migration migrations/v6} + {:schema v7 :schemaVersion 7 - :migration v7/migration} - {:schema v8/schema + :migration migrations/v7} + {:schema v8 :schemaVersion 8 - :migration v8/migration} - {:schema v9/schema + :migration migrations/v8} + {:schema v9 :schemaVersion 9 - :migration v9/migration} - {:schema v10/schema + :migration migrations/v9} + {:schema v10 :schemaVersion 10 - :migration v10/migration} - {:schema v11/schema + :migration migrations/v10} + {:schema v11 :schemaVersion 11 - :migration v11/migration}]) + :migration migrations/v11}]) diff --git a/src/status_im/data_store/realm/schemas/account/dapp_permissions.cljs b/src/status_im/data_store/realm/schemas/account/dapp_permissions.cljs new file mode 100644 index 0000000000..a7c07882c5 --- /dev/null +++ b/src/status_im/data_store/realm/schemas/account/dapp_permissions.cljs @@ -0,0 +1,7 @@ +(ns status-im.data-store.realm.schemas.account.dapp-permissions) + +(def v9 {:name :dapp-permissions + :primaryKey :dapp + :properties {:dapp :string + :permissions {:type "string[]" + :optional true}}}) diff --git a/src/status_im/data_store/realm/schemas/account/local_storage.cljs b/src/status_im/data_store/realm/schemas/account/local_storage.cljs new file mode 100644 index 0000000000..7d0c61ba85 --- /dev/null +++ b/src/status_im/data_store/realm/schemas/account/local_storage.cljs @@ -0,0 +1,7 @@ +(ns status-im.data-store.realm.schemas.account.local-storage) + +(def v1 {:name :local-storage + :primaryKey :chat-id + :properties {:chat-id :string + :data {:type :string + :default "{}"}}}) diff --git a/src/status_im/data_store/realm/schemas/account/mailserver.cljs b/src/status_im/data_store/realm/schemas/account/mailserver.cljs new file mode 100644 index 0000000000..c9e4ccf5b7 --- /dev/null +++ b/src/status_im/data_store/realm/schemas/account/mailserver.cljs @@ -0,0 +1,19 @@ +(ns status-im.data-store.realm.schemas.account.mailserver) + +(def v2 {:name :mailserver + :primaryKey :id + :properties {:id :string + :name {:type :string} + :address {:type :string} + :password {:type :string + :optional true} + :chain {:type :string}}}) + +(def v11 {:name :mailserver + :primaryKey :id + :properties {:id :string + :name {:type :string} + :address {:type :string} + :password {:type :string + :optional true} + :fleet {:type :string}}}) diff --git a/src/status_im/data_store/realm/schemas/account/message.cljs b/src/status_im/data_store/realm/schemas/account/message.cljs new file mode 100644 index 0000000000..6e4da818c8 --- /dev/null +++ b/src/status_im/data_store/realm/schemas/account/message.cljs @@ -0,0 +1,53 @@ +(ns status-im.data-store.realm.schemas.account.message) + +(def v1 {:name :message + :primaryKey :message-id + :properties {:message-id :string + :from :string + :to {:type :string + :optional true} + :content :string ; TODO make it ArrayBuffer + :content-type :string + :username {:type :string + :optional true} + :timestamp :int + :chat-id {:type :string + :indexed true} + :outgoing :bool + :retry-count {:type :int + :default 0} + :message-type {:type :string + :optional true} + :message-status {:type :string + :optional true} + :user-statuses {:type :list + :objectType :user-status} + :clock-value {:type :int + :default 0} + :show? {:type :bool + :default true}}}) + +(def v7 {:name :message + :primaryKey :message-id + :properties {:message-id :string + :from :string + :to {:type :string + :optional true} + :content :string ; TODO make it ArrayBuffer + :content-type :string + :username {:type :string + :optional true} + :timestamp :int + :chat-id {:type :string + :indexed true} + :outgoing :bool + :retry-count {:type :int + :default 0} + :message-type {:type :string + :optional true} + :message-status {:type :string + :optional true} + :clock-value {:type :int + :default 0} + :show? {:type :bool + :default true}}}) diff --git a/src/status_im/data_store/realm/schemas/account/migrations.cljs b/src/status_im/data_store/realm/schemas/account/migrations.cljs new file mode 100644 index 0000000000..52521be3fc --- /dev/null +++ b/src/status_im/data_store/realm/schemas/account/migrations.cljs @@ -0,0 +1,68 @@ +(ns status-im.data-store.realm.schemas.account.migrations + (:require [taoensso.timbre :as log] + [cljs.reader :as reader])) + +(defn v1 [old-realm new-realm] + (log/debug "migrating v1 account database: " old-realm new-realm)) + +(defn v2 [old-realm new-realm] + (log/debug "migrating v2 account database: " old-realm new-realm)) + +(defn v3 [old-realm new-realm] + (log/debug "migrating v3 account database: " old-realm new-realm)) + +(defn v4 [old-realm new-realm] + (log/debug "migrating v4 account database: " old-realm new-realm)) + +(defn v5 [old-realm new-realm] + (log/debug "migrating chats schema v5") + (let [chats (.objects new-realm "chat")] + (dotimes [i (.-length chats)] + (js-delete (aget chats i) "contact-info")))) + +(defn v6 [old-realm new-realm] + (log/debug "migrating v6 account database: " old-realm new-realm)) + +(defn v7 [old-realm new-realm] + (log/debug "migrating messages schema v7") + (let [messages (.objects new-realm "message")] + (dotimes [i (.-length messages)] + (js-delete (aget messages i) "user-statuses")))) + +(defn message-by-id [realm message-id] + (some-> realm + (.objects "message") + (.filtered (str "message-id = \"" message-id "\"")) + (aget 0))) + +(defn v8 [old-realm new-realm] + (log/debug "migrating v8 account database") + (let [browsers (.objects new-realm "browser") + old-browsers (.objects old-realm "browser")] + (dotimes [i (.-length browsers)] + (let [browser (aget browsers i) + old-browser (aget old-browsers i) + url (aget old-browser "url")] + (aset browser "history-index" 0) + (aset browser "history" (clj->js [url])))))) + +(defn v9 [old-realm new-realm] + (log/debug "migrating v9 account database")) + +(defn v10 [old-realm new-realm] + (log/debug "migrating v10 account database") + (some-> old-realm + (.objects "request") + (.filtered (str "status = \"answered\"")) + (.map (fn [request _ _] + (let [message-id (aget request "message-id") + message (message-by-id new-realm message-id) + content (reader/read-string (aget message "content")) + new-content (assoc-in content [:params :answered?] true)] + (aset message "content" (pr-str new-content))))))) + +(defn v11 [old-realm new-realm] + (log/debug "migrating v11 account database") + (let [mailservers (.objects new-realm "mailserver")] + (dotimes [i (.-length mailservers)] + (aset (aget mailservers i) "fleet" "eth.beta")))) diff --git a/src/status_im/data_store/realm/schemas/account/request.cljs b/src/status_im/data_store/realm/schemas/account/request.cljs new file mode 100644 index 0000000000..4f2daa82ff --- /dev/null +++ b/src/status_im/data_store/realm/schemas/account/request.cljs @@ -0,0 +1,8 @@ +(ns status-im.data-store.realm.schemas.account.request) + +(def v1 {:name :request + :properties {:message-id :string + :chat-id :string + :response :string + :status {:type :string + :default "open"}}}) diff --git a/src/status_im/data_store/realm/schemas/account/transport.cljs b/src/status_im/data_store/realm/schemas/account/transport.cljs new file mode 100644 index 0000000000..8e548b3c31 --- /dev/null +++ b/src/status_im/data_store/realm/schemas/account/transport.cljs @@ -0,0 +1,49 @@ +(ns status-im.data-store.realm.schemas.account.transport) + +(def v1 {:name :transport + :primaryKey :chat-id + :properties {:chat-id :string + :ack :string + :seen :string + :pending-ack :string + :pending-send :string + :topic :string + :sym-key-id {:type :string + :optional true} + ;;TODO (yenda) remove once go implements persistence + :sym-key {:type :string + :optional true}}}) + +(def v4 {:name :transport + :primaryKey :chat-id + :properties {:chat-id :string + :ack :string + :seen :string + :pending-ack :string + :pending-send :string + :topic :string + :fetch-history? {:type :bool + :default false} + :sym-key-id {:type :string + :optional true} + ;;TODO (yenda) remove once go implements persistence + :sym-key {:type :string + :optional true}}}) + +(def v6 {:name :transport + :primaryKey :chat-id + :properties {:chat-id :string + :ack :string + :seen :string + :pending-ack :string + :pending-send :string + :topic :string + :fetch-history? {:type :bool + :default false} + :resend? {:type :string + :optional true} + :sym-key-id {:type :string + :optional true} + ;;TODO (yenda) remove once go implements persistence + :sym-key {:type :string + :optional true}}}) diff --git a/src/status_im/data_store/realm/schemas/account/user_status.cljs b/src/status_im/data_store/realm/schemas/account/user_status.cljs new file mode 100644 index 0000000000..8d3d83c484 --- /dev/null +++ b/src/status_im/data_store/realm/schemas/account/user_status.cljs @@ -0,0 +1,12 @@ +(ns status-im.data-store.realm.schemas.account.user-status) + +(def v1 {:name :user-status + :primaryKey :status-id + :properties {;; Unfortunately, realm doesn't support composite primary keys, + ;; so we have to keep separate `:status-id` property, which is just + ;; `:message-id`-`:whisper-identity` concatenated + :status-id :string + :message-id :string + :chat-id :string + :whisper-identity :string + :status :string}}) diff --git a/src/status_im/data_store/realm/schemas/account/v1/browser.cljs b/src/status_im/data_store/realm/schemas/account/v1/browser.cljs deleted file mode 100644 index aa82ebaba4..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v1/browser.cljs +++ /dev/null @@ -1,13 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v1.browser) - -(def schema {:name :browser - :primaryKey :browser-id - :properties {:browser-id :string - :name :string - :timestamp :int - :dapp? {:type :bool - :default false} - :url {:type :string - :optional true} - :contact {:type :string - :optional true}}}) diff --git a/src/status_im/data_store/realm/schemas/account/v1/chat.cljs b/src/status_im/data_store/realm/schemas/account/v1/chat.cljs deleted file mode 100644 index 4f93cb915b..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v1/chat.cljs +++ /dev/null @@ -1,32 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v1.chat - (:require [status-im.ui.components.styles :refer [default-chat-color]])) - -(def schema {:name :chat - :primaryKey :chat-id - :properties {:chat-id :string - :name :string - :color {:type :string - :default default-chat-color} - :group-chat {:type :bool - :indexed true} - :group-admin {:type :string - :optional true} - :is-active :bool - :timestamp :int - :contacts {:type "string[]"} - :removed-at {:type :int - :optional true} - :removed-from-at {:type :int - :optional true} - :added-to-at {:type :int - :optional true} - :updated-at {:type :int - :optional true} - :message-overhead {:type :int - :default 0} - :contact-info {:type :string - :optional true} - :debug? {:type :bool - :default false} - :public? {:type :bool - :default false}}}) diff --git a/src/status_im/data_store/realm/schemas/account/v1/chat_contact.cljs b/src/status_im/data_store/realm/schemas/account/v1/chat_contact.cljs deleted file mode 100644 index ff56e0d07b..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v1/chat_contact.cljs +++ /dev/null @@ -1,7 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v1.chat-contact - (:require [taoensso.timbre :as log])) - -(def schema {:name :chat-contact - :properties {:identity "string" - :is-in-chat {:type "bool" - :default true}}}) diff --git a/src/status_im/data_store/realm/schemas/account/v1/contact.cljs b/src/status_im/data_store/realm/schemas/account/v1/contact.cljs deleted file mode 100644 index c42f8e2303..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v1/contact.cljs +++ /dev/null @@ -1,28 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v1.contact - (:require [taoensso.timbre :as log])) - -(def schema {:name :contact - :primaryKey :whisper-identity - :properties {:address {:type :string :optional true} - :whisper-identity :string - :name {:type :string :optional true} - :photo-path {:type :string :optional true} - :last-updated {:type :int :default 0} - :last-online {:type :int :default 0} - :pending? {:type :bool :default false} - :hide-contact? {:type :bool :default false} - :status {:type :string :optional true} - :fcm-token {:type :string :optional true} - :description {:type :string :optional true} - :public-key {:type :string - :optional true} - :dapp? {:type :bool - :default false} - :dapp-url {:type :string - :optional true} - :bot-url {:type :string - :optional true} - :dapp-hash {:type :int - :optional true} - :debug? {:type :bool - :default false}}}) diff --git a/src/status_im/data_store/realm/schemas/account/v1/core.cljs b/src/status_im/data_store/realm/schemas/account/v1/core.cljs deleted file mode 100644 index 24a85c51fd..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v1/core.cljs +++ /dev/null @@ -1,22 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v1.core - (:require [status-im.data-store.realm.schemas.account.v1.chat :as chat] - [status-im.data-store.realm.schemas.account.v1.transport :as transport] - [status-im.data-store.realm.schemas.account.v1.contact :as contact] - [status-im.data-store.realm.schemas.account.v1.message :as message] - [status-im.data-store.realm.schemas.account.v1.request :as request] - [status-im.data-store.realm.schemas.account.v1.user-status :as user-status] - [status-im.data-store.realm.schemas.account.v1.local-storage :as local-storage] - [status-im.data-store.realm.schemas.account.v1.browser :as browser] - [taoensso.timbre :as log])) - -(def schema [chat/schema - transport/schema - contact/schema - message/schema - request/schema - user-status/schema - local-storage/schema - browser/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating v1 account database: " old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/account/v1/group_contact.cljs b/src/status_im/data_store/realm/schemas/account/v1/group_contact.cljs deleted file mode 100644 index 68df433a13..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v1/group_contact.cljs +++ /dev/null @@ -1,5 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v1.group-contact - (:require [taoensso.timbre :as log])) - -(def schema {:name :group-contact - :properties {:identity "string"}}) diff --git a/src/status_im/data_store/realm/schemas/account/v1/local_storage.cljs b/src/status_im/data_store/realm/schemas/account/v1/local_storage.cljs deleted file mode 100644 index 9c6c101e71..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v1/local_storage.cljs +++ /dev/null @@ -1,7 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v1.local-storage) - -(def schema {:name :local-storage - :primaryKey :chat-id - :properties {:chat-id :string - :data {:type :string - :default "{}"}}}) diff --git a/src/status_im/data_store/realm/schemas/account/v1/message.cljs b/src/status_im/data_store/realm/schemas/account/v1/message.cljs deleted file mode 100644 index ca3ebadaa6..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v1/message.cljs +++ /dev/null @@ -1,28 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v1.message) - -(def schema {:name :message - :primaryKey :message-id - :properties {:message-id :string - :from :string - :to {:type :string - :optional true} - :content :string ; TODO make it ArrayBuffer - :content-type :string - :username {:type :string - :optional true} - :timestamp :int - :chat-id {:type :string - :indexed true} - :outgoing :bool - :retry-count {:type :int - :default 0} - :message-type {:type :string - :optional true} - :message-status {:type :string - :optional true} - :user-statuses {:type :list - :objectType :user-status} - :clock-value {:type :int - :default 0} - :show? {:type :bool - :default true}}}) diff --git a/src/status_im/data_store/realm/schemas/account/v1/request.cljs b/src/status_im/data_store/realm/schemas/account/v1/request.cljs deleted file mode 100644 index 8981ec3042..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v1/request.cljs +++ /dev/null @@ -1,8 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v1.request) - -(def schema {:name :request - :properties {:message-id :string - :chat-id :string - :response :string - :status {:type :string - :default "open"}}}) diff --git a/src/status_im/data_store/realm/schemas/account/v1/transport.cljs b/src/status_im/data_store/realm/schemas/account/v1/transport.cljs deleted file mode 100644 index 8399164bd5..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v1/transport.cljs +++ /dev/null @@ -1,15 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v1.transport) - -(def schema {:name :transport - :primaryKey :chat-id - :properties {:chat-id :string - :ack :string - :seen :string - :pending-ack :string - :pending-send :string - :topic :string - :sym-key-id {:type :string - :optional true} - ;;TODO (yenda) remove once go implements persistence - :sym-key {:type :string - :optional true}}}) diff --git a/src/status_im/data_store/realm/schemas/account/v1/user_status.cljs b/src/status_im/data_store/realm/schemas/account/v1/user_status.cljs deleted file mode 100644 index b94a1ff0c9..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v1/user_status.cljs +++ /dev/null @@ -1,12 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v1.user-status) - -(def schema {:name :user-status - :primaryKey :status-id - :properties {;; Unfortunately, realm doesn't support composite primary keys, - ;; so we have to keep separate `:status-id` property, which is just - ;; `:message-id`-`:whisper-identity` concatenated - :status-id :string - :message-id :string - :chat-id :string - :whisper-identity :string - :status :string}}) diff --git a/src/status_im/data_store/realm/schemas/account/v10/core.cljs b/src/status_im/data_store/realm/schemas/account/v10/core.cljs deleted file mode 100644 index cec672942c..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v10/core.cljs +++ /dev/null @@ -1,40 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v10.core - (:require [status-im.data-store.realm.schemas.account.v5.chat :as chat] - [status-im.data-store.realm.schemas.account.v6.transport :as transport] - [status-im.data-store.realm.schemas.account.v1.contact :as contact] - [status-im.data-store.realm.schemas.account.v7.message :as message] - [status-im.data-store.realm.schemas.account.v1.user-status :as user-status] - [status-im.data-store.realm.schemas.account.v1.local-storage :as local-storage] - [status-im.data-store.realm.schemas.account.v2.mailserver :as mailserver] - [status-im.data-store.realm.schemas.account.v8.browser :as browser] - [status-im.data-store.realm.schemas.account.v9.dapp-permissions :as dapp-permissions] - [cljs.reader :as reader] - [taoensso.timbre :as log])) - -(def schema [chat/schema - transport/schema - contact/schema - message/schema - mailserver/schema - user-status/schema - local-storage/schema - browser/schema - dapp-permissions/schema]) - -(defn message-by-id [realm message-id] - (some-> realm - (.objects "message") - (.filtered (str "message-id = \"" message-id "\"")) - (aget 0))) - -(defn migration [old-realm new-realm] - (log/debug "migrating v10 account database") - (some-> old-realm - (.objects "request") - (.filtered (str "status = \"answered\"")) - (.map (fn [request _ _] - (let [message-id (aget request "message-id") - message (message-by-id new-realm message-id) - content (reader/read-string (aget message "content")) - new-content (assoc-in content [:params :answered?] true)] - (aset message "content" (pr-str new-content))))))) diff --git a/src/status_im/data_store/realm/schemas/account/v11/core.cljs b/src/status_im/data_store/realm/schemas/account/v11/core.cljs deleted file mode 100644 index 6fc927a080..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v11/core.cljs +++ /dev/null @@ -1,25 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v11.core - (:require [status-im.data-store.realm.schemas.account.v5.chat :as chat] - [status-im.data-store.realm.schemas.account.v6.transport :as transport] - [status-im.data-store.realm.schemas.account.v1.contact :as contact] - [status-im.data-store.realm.schemas.account.v7.message :as message] - [status-im.data-store.realm.schemas.account.v1.user-status :as user-status] - [status-im.data-store.realm.schemas.account.v1.local-storage :as local-storage] - [status-im.data-store.realm.schemas.account.v11.mailserver :as mailserver] - [status-im.data-store.realm.schemas.account.v8.browser :as browser] - [status-im.data-store.realm.schemas.account.v9.dapp-permissions :as dapp-permissions] - [taoensso.timbre :as log])) - -(def schema [chat/schema - transport/schema - contact/schema - message/schema - mailserver/schema - user-status/schema - local-storage/schema - browser/schema - dapp-permissions/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating v11 account database: " old-realm new-realm) - (mailserver/migration old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/account/v11/mailserver.cljs b/src/status_im/data_store/realm/schemas/account/v11/mailserver.cljs deleted file mode 100644 index 8e72e3afa6..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v11/mailserver.cljs +++ /dev/null @@ -1,17 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v11.mailserver - (:require [taoensso.timbre :as log])) - -(def schema {:name :mailserver - :primaryKey :id - :properties {:id :string - :name {:type :string} - :address {:type :string} - :password {:type :string - :optional true} - :fleet {:type :string}}}) - -(defn migration [old-realm new-realm] - (log/debug "migrating mailservers schema v10") - (let [mailservers (.objects new-realm "mailserver")] - (dotimes [i (.-length mailservers)] - (aset (aget mailservers i) "fleet" "eth.beta")))) diff --git a/src/status_im/data_store/realm/schemas/account/v2/core.cljs b/src/status_im/data_store/realm/schemas/account/v2/core.cljs deleted file mode 100644 index dea2f508b4..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v2/core.cljs +++ /dev/null @@ -1,24 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v2.core - (:require [status-im.data-store.realm.schemas.account.v1.chat :as chat] - [status-im.data-store.realm.schemas.account.v1.transport :as transport] - [status-im.data-store.realm.schemas.account.v1.contact :as contact] - [status-im.data-store.realm.schemas.account.v1.message :as message] - [status-im.data-store.realm.schemas.account.v1.request :as request] - [status-im.data-store.realm.schemas.account.v1.user-status :as user-status] - [status-im.data-store.realm.schemas.account.v1.local-storage :as local-storage] - [status-im.data-store.realm.schemas.account.v2.mailserver :as mailserver] - [status-im.data-store.realm.schemas.account.v1.browser :as browser] - [taoensso.timbre :as log])) - -(def schema [chat/schema - transport/schema - contact/schema - message/schema - request/schema - mailserver/schema - user-status/schema - local-storage/schema - browser/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating v2 account database: " old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/account/v2/mailserver.cljs b/src/status_im/data_store/realm/schemas/account/v2/mailserver.cljs deleted file mode 100644 index d4cab1452c..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v2/mailserver.cljs +++ /dev/null @@ -1,11 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v2.mailserver - (:require [taoensso.timbre :as log])) - -(def schema {:name :mailserver - :primaryKey :id - :properties {:id :string - :name {:type :string} - :address {:type :string} - :password {:type :string - :optional true} - :chain {:type :string}}}) diff --git a/src/status_im/data_store/realm/schemas/account/v3/chat.cljs b/src/status_im/data_store/realm/schemas/account/v3/chat.cljs deleted file mode 100644 index 5c34a79bdf..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v3/chat.cljs +++ /dev/null @@ -1,34 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v3.chat - (:require [status-im.ui.components.styles :refer [default-chat-color]])) - -(def schema {:name :chat - :primaryKey :chat-id - :properties {:chat-id :string - :name :string - :color {:type :string - :default default-chat-color} - :group-chat {:type :bool - :indexed true} - :group-admin {:type :string - :optional true} - :is-active :bool - :timestamp :int - :contacts {:type "string[]"} - :removed-at {:type :int - :optional true} - :removed-from-at {:type :int - :optional true} - :deleted-at-clock-value {:type :int - :optional true} - :added-to-at {:type :int - :optional true} - :updated-at {:type :int - :optional true} - :message-overhead {:type :int - :default 0} - :contact-info {:type :string - :optional true} - :debug? {:type :bool - :default false} - :public? {:type :bool - :default false}}}) diff --git a/src/status_im/data_store/realm/schemas/account/v3/core.cljs b/src/status_im/data_store/realm/schemas/account/v3/core.cljs deleted file mode 100644 index c9cb072340..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v3/core.cljs +++ /dev/null @@ -1,24 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v3.core - (:require [status-im.data-store.realm.schemas.account.v3.chat :as chat] - [status-im.data-store.realm.schemas.account.v1.transport :as transport] - [status-im.data-store.realm.schemas.account.v1.contact :as contact] - [status-im.data-store.realm.schemas.account.v1.message :as message] - [status-im.data-store.realm.schemas.account.v1.request :as request] - [status-im.data-store.realm.schemas.account.v2.mailserver :as mailserver] - [status-im.data-store.realm.schemas.account.v1.user-status :as user-status] - [status-im.data-store.realm.schemas.account.v1.local-storage :as local-storage] - [status-im.data-store.realm.schemas.account.v1.browser :as browser] - [taoensso.timbre :as log])) - -(def schema [chat/schema - transport/schema - contact/schema - message/schema - request/schema - mailserver/schema - user-status/schema - local-storage/schema - browser/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating v3 account database: " old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/account/v4/core.cljs b/src/status_im/data_store/realm/schemas/account/v4/core.cljs deleted file mode 100644 index ac7b9350f4..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v4/core.cljs +++ /dev/null @@ -1,24 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v4.core - (:require [status-im.data-store.realm.schemas.account.v3.chat :as chat] - [status-im.data-store.realm.schemas.account.v4.transport :as transport] - [status-im.data-store.realm.schemas.account.v1.contact :as contact] - [status-im.data-store.realm.schemas.account.v1.message :as message] - [status-im.data-store.realm.schemas.account.v1.request :as request] - [status-im.data-store.realm.schemas.account.v1.user-status :as user-status] - [status-im.data-store.realm.schemas.account.v1.local-storage :as local-storage] - [status-im.data-store.realm.schemas.account.v2.mailserver :as mailserver] - [status-im.data-store.realm.schemas.account.v1.browser :as browser] - [taoensso.timbre :as log])) - -(def schema [chat/schema - transport/schema - contact/schema - message/schema - request/schema - mailserver/schema - user-status/schema - local-storage/schema - browser/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating v4 account database: " old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/account/v4/transport.cljs b/src/status_im/data_store/realm/schemas/account/v4/transport.cljs deleted file mode 100644 index d74ffab020..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v4/transport.cljs +++ /dev/null @@ -1,17 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v4.transport) - -(def schema {:name :transport - :primaryKey :chat-id - :properties {:chat-id :string - :ack :string - :seen :string - :pending-ack :string - :pending-send :string - :topic :string - :fetch-history? {:type :bool - :default false} - :sym-key-id {:type :string - :optional true} - ;;TODO (yenda) remove once go implements persistence - :sym-key {:type :string - :optional true}}}) diff --git a/src/status_im/data_store/realm/schemas/account/v5/chat.cljs b/src/status_im/data_store/realm/schemas/account/v5/chat.cljs deleted file mode 100644 index 29cb43751d..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v5/chat.cljs +++ /dev/null @@ -1,40 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v5.chat - (:require - [taoensso.timbre :as log] - [status-im.ui.components.styles :refer [default-chat-color]])) - -(def schema {:name :chat - :primaryKey :chat-id - :properties {:chat-id :string - :name :string - :color {:type :string - :default default-chat-color} - :group-chat {:type :bool - :indexed true} - :group-admin {:type :string - :optional true} - :is-active :bool - :timestamp :int - :contacts {:type "string[]"} - :removed-at {:type :int - :optional true} - :removed-from-at {:type :int - :optional true} - :deleted-at-clock-value {:type :int - :optional true} - :added-to-at {:type :int - :optional true} - :updated-at {:type :int - :optional true} - :message-overhead {:type :int - :default 0} - :debug? {:type :bool - :default false} - :public? {:type :bool - :default false}}}) - -(defn migration [old-realm new-realm] - (log/debug "migrating chats schema v5") - (let [chats (.objects new-realm "chat")] - (dotimes [i (.-length chats)] - (js-delete (aget chats i) "contact-info")))) diff --git a/src/status_im/data_store/realm/schemas/account/v5/core.cljs b/src/status_im/data_store/realm/schemas/account/v5/core.cljs deleted file mode 100644 index 8384e78d70..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v5/core.cljs +++ /dev/null @@ -1,25 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v5.core - (:require [status-im.data-store.realm.schemas.account.v5.chat :as chat] - [status-im.data-store.realm.schemas.account.v4.transport :as transport] - [status-im.data-store.realm.schemas.account.v1.contact :as contact] - [status-im.data-store.realm.schemas.account.v1.message :as message] - [status-im.data-store.realm.schemas.account.v1.request :as request] - [status-im.data-store.realm.schemas.account.v1.user-status :as user-status] - [status-im.data-store.realm.schemas.account.v1.local-storage :as local-storage] - [status-im.data-store.realm.schemas.account.v2.mailserver :as mailserver] - [status-im.data-store.realm.schemas.account.v1.browser :as browser] - [taoensso.timbre :as log])) - -(def schema [chat/schema - transport/schema - contact/schema - message/schema - request/schema - mailserver/schema - user-status/schema - local-storage/schema - browser/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating v5 account database: " old-realm new-realm) - (chat/migration old-realm new-realm)) 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 deleted file mode 100644 index e612a33f12..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v6/core.cljs +++ /dev/null @@ -1,24 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v6.core - (:require [status-im.data-store.realm.schemas.account.v5.chat :as chat] - [status-im.data-store.realm.schemas.account.v6.transport :as transport] - [status-im.data-store.realm.schemas.account.v1.contact :as contact] - [status-im.data-store.realm.schemas.account.v1.message :as message] - [status-im.data-store.realm.schemas.account.v1.request :as request] - [status-im.data-store.realm.schemas.account.v1.user-status :as user-status] - [status-im.data-store.realm.schemas.account.v1.local-storage :as local-storage] - [status-im.data-store.realm.schemas.account.v2.mailserver :as mailserver] - [status-im.data-store.realm.schemas.account.v1.browser :as browser] - [taoensso.timbre :as log])) - -(def schema [chat/schema - transport/schema - contact/schema - message/schema - request/schema - mailserver/schema - user-status/schema - local-storage/schema - browser/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating v6 account database: " old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/account/v6/transport.cljs b/src/status_im/data_store/realm/schemas/account/v6/transport.cljs deleted file mode 100644 index 1ff3309be3..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v6/transport.cljs +++ /dev/null @@ -1,19 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v6.transport) - -(def schema {:name :transport - :primaryKey :chat-id - :properties {:chat-id :string - :ack :string - :seen :string - :pending-ack :string - :pending-send :string - :topic :string - :fetch-history? {:type :bool - :default false} - :resend? {:type :string - :optional true} - :sym-key-id {:type :string - :optional true} - ;;TODO (yenda) remove once go implements persistence - :sym-key {:type :string - :optional true}}}) diff --git a/src/status_im/data_store/realm/schemas/account/v7/core.cljs b/src/status_im/data_store/realm/schemas/account/v7/core.cljs deleted file mode 100644 index 4ed30d5852..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v7/core.cljs +++ /dev/null @@ -1,25 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v7.core - (:require [status-im.data-store.realm.schemas.account.v5.chat :as chat] - [status-im.data-store.realm.schemas.account.v6.transport :as transport] - [status-im.data-store.realm.schemas.account.v1.contact :as contact] - [status-im.data-store.realm.schemas.account.v7.message :as message] - [status-im.data-store.realm.schemas.account.v1.request :as request] - [status-im.data-store.realm.schemas.account.v1.user-status :as user-status] - [status-im.data-store.realm.schemas.account.v1.local-storage :as local-storage] - [status-im.data-store.realm.schemas.account.v2.mailserver :as mailserver] - [status-im.data-store.realm.schemas.account.v1.browser :as browser] - [taoensso.timbre :as log])) - -(def schema [chat/schema - transport/schema - contact/schema - message/schema - request/schema - mailserver/schema - user-status/schema - local-storage/schema - browser/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating v7 account database: " old-realm new-realm) - (message/migration old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/account/v7/message.cljs b/src/status_im/data_store/realm/schemas/account/v7/message.cljs deleted file mode 100644 index 0a44c9ddcd..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v7/message.cljs +++ /dev/null @@ -1,33 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v7.message - (:require [taoensso.timbre :as log])) - -(def schema {:name :message - :primaryKey :message-id - :properties {:message-id :string - :from :string - :to {:type :string - :optional true} - :content :string ; TODO make it ArrayBuffer - :content-type :string - :username {:type :string - :optional true} - :timestamp :int - :chat-id {:type :string - :indexed true} - :outgoing :bool - :retry-count {:type :int - :default 0} - :message-type {:type :string - :optional true} - :message-status {:type :string - :optional true} - :clock-value {:type :int - :default 0} - :show? {:type :bool - :default true}}}) - -(defn migration [old-realm new-realm] - (log/debug "migrating messages schema v7") - (let [messages (.objects new-realm "message")] - (dotimes [i (.-length messages)] - (js-delete (aget messages i) "user-statuses")))) diff --git a/src/status_im/data_store/realm/schemas/account/v8/browser.cljs b/src/status_im/data_store/realm/schemas/account/v8/browser.cljs deleted file mode 100644 index 24e88108eb..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v8/browser.cljs +++ /dev/null @@ -1,25 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v8.browser - (:require [taoensso.timbre :as log])) - -(def schema {:name :browser - :primaryKey :browser-id - :properties {:browser-id :string - :name :string - :timestamp :int - :dapp? {:type :bool - :default false} - :history-index {:type :int - :optional true} - :history {:type "string[]" - :optional true}}}) - -(defn migration [old-realm new-realm] - (log/debug "migrating browser schema v8") - (let [browsers (.objects new-realm "browser") - old-browsers (.objects old-realm "browser")] - (dotimes [i (.-length browsers)] - (let [browser (aget browsers i) - old-browser (aget old-browsers i) - url (aget old-browser "url")] - (aset browser "history-index" 0) - (aset browser "history" (clj->js [url])))))) \ No newline at end of file diff --git a/src/status_im/data_store/realm/schemas/account/v8/core.cljs b/src/status_im/data_store/realm/schemas/account/v8/core.cljs deleted file mode 100644 index 3342bf8d13..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v8/core.cljs +++ /dev/null @@ -1,25 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v8.core - (:require [status-im.data-store.realm.schemas.account.v5.chat :as chat] - [status-im.data-store.realm.schemas.account.v6.transport :as transport] - [status-im.data-store.realm.schemas.account.v1.contact :as contact] - [status-im.data-store.realm.schemas.account.v7.message :as message] - [status-im.data-store.realm.schemas.account.v1.request :as request] - [status-im.data-store.realm.schemas.account.v1.user-status :as user-status] - [status-im.data-store.realm.schemas.account.v1.local-storage :as local-storage] - [status-im.data-store.realm.schemas.account.v2.mailserver :as mailserver] - [status-im.data-store.realm.schemas.account.v8.browser :as browser] - [taoensso.timbre :as log])) - -(def schema [chat/schema - transport/schema - contact/schema - message/schema - request/schema - mailserver/schema - user-status/schema - local-storage/schema - browser/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating v8 account database: " old-realm new-realm) - (browser/migration old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/account/v9/core.cljs b/src/status_im/data_store/realm/schemas/account/v9/core.cljs deleted file mode 100644 index e6f30def05..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v9/core.cljs +++ /dev/null @@ -1,26 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v9.core - (:require [status-im.data-store.realm.schemas.account.v5.chat :as chat] - [status-im.data-store.realm.schemas.account.v6.transport :as transport] - [status-im.data-store.realm.schemas.account.v1.contact :as contact] - [status-im.data-store.realm.schemas.account.v7.message :as message] - [status-im.data-store.realm.schemas.account.v1.request :as request] - [status-im.data-store.realm.schemas.account.v1.user-status :as user-status] - [status-im.data-store.realm.schemas.account.v1.local-storage :as local-storage] - [status-im.data-store.realm.schemas.account.v2.mailserver :as mailserver] - [status-im.data-store.realm.schemas.account.v8.browser :as browser] - [status-im.data-store.realm.schemas.account.v9.dapp-permissions :as dapp-permissions] - [taoensso.timbre :as log])) - -(def schema [chat/schema - transport/schema - contact/schema - message/schema - request/schema - mailserver/schema - user-status/schema - local-storage/schema - browser/schema - dapp-permissions/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating v9 account database: " old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/account/v9/dapp_permissions.cljs b/src/status_im/data_store/realm/schemas/account/v9/dapp_permissions.cljs deleted file mode 100644 index 9b3cf5c52f..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v9/dapp_permissions.cljs +++ /dev/null @@ -1,7 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v9.dapp-permissions) - -(def schema {:name :dapp-permissions - :primaryKey :dapp - :properties {:dapp :string - :permissions {:type "string[]" - :optional true}}}) \ No newline at end of file diff --git a/src/status_im/data_store/realm/schemas/base/account.cljs b/src/status_im/data_store/realm/schemas/base/account.cljs new file mode 100644 index 0000000000..802636c91a --- /dev/null +++ b/src/status_im/data_store/realm/schemas/base/account.cljs @@ -0,0 +1,200 @@ +(ns status-im.data-store.realm.schemas.base.account) + +(def v1 {:name :account + :primaryKey :address + :properties {:address :string + :public-key :string + :name {:type :string :optional true} + :email {:type :string :optional true} + :status {:type :string :optional true} + :debug? {:type :bool :default false} + :photo-path :string + :signing-phrase {:type :string} + :mnemonic {:type :string} + :last-updated {:type :int :default 0} + :last-sign-in {:type :int :default 0} + :signed-up? {:type :bool + :default false} + :network :string + :networks {:type :list + :objectType :network} + :settings {:type :string} + :sharing-usage-data? {:type :bool :default false} + :dev-mode? {:type :bool :default false} + :seed-backed-up? {:type :bool :default false} + :wallet-set-up-passed? {:type :bool :default false}}}) + +(def v2 {:name :account + :primaryKey :address + :properties {:address :string + :public-key :string + :name {:type :string :optional true} + :email {:type :string :optional true} + :status {:type :string :optional true} + :debug? {:type :bool :default false} + :photo-path :string + :signing-phrase {:type :string} + :mnemonic {:type :string :optional true} + :last-updated {:type :int :default 0} + :last-sign-in {:type :int :default 0} + :signed-up? {:type :bool + :default false} + :network :string + :networks {:type :list + :objectType :network} + :settings {:type :string} + :sharing-usage-data? {:type :bool :default false} + :dev-mode? {:type :bool :default false} + :seed-backed-up? {:type :bool :default false} + :wallet-set-up-passed? {:type :bool + :default false}}}) + +(def v3 {:name :account + :primaryKey :address + :properties {:address :string + :public-key :string + :name {:type :string :optional true} + :email {:type :string :optional true} + :status {:type :string :optional true} + :debug? {:type :bool :default false} + :photo-path :string + :signing-phrase {:type :string} + :mnemonic {:type :string :optional true} + :last-updated {:type :int :default 0} + :last-sign-in {:type :int :default 0} + :signed-up? {:type :bool + :default false} + :network :string + :networks {:type :list + :objectType :network} + :last-request {:type :int :optional true} + :settings {:type :string} + :sharing-usage-data? {:type :bool :default false} + :dev-mode? {:type :bool :default false} + :seed-backed-up? {:type :bool :default false} + :wallet-set-up-passed? {:type :bool + :default false}}}) + +(def v4 {:name :account + :primaryKey :address + :properties {:address :string + :public-key :string + :name {:type :string :optional true} + :email {:type :string :optional true} + :status {:type :string :optional true} + :debug? {:type :bool :default false} + :photo-path :string + :signing-phrase {:type :string} + :mnemonic {:type :string :optional true} + :last-updated {:type :int :default 0} + :last-sign-in {:type :int :default 0} + :signed-up? {:type :bool + :default false} + :network :string + :networks {:type :list + :objectType :network} + :bootnodes {:type :list + :objectType :bootnode} + :last-request {:type :int :optional true} + :settings {:type :string} + :sharing-usage-data? {:type :bool :default false} + :dev-mode? {:type :bool :default false} + :seed-backed-up? {:type :bool :default false} + :wallet-set-up-passed? {:type :bool + :default false}}}) + +(def v6 {:name :account + :primaryKey :address + :properties {:address :string + :public-key :string + :name {:type :string :optional true} + :email {:type :string :optional true} + :status {:type :string :optional true} + :debug? {:type :bool :default false} + :photo-path :string + :signing-phrase {:type :string} + :mnemonic {:type :string :optional true} + :last-updated {:type :int :default 0} + :last-sign-in {:type :int :default 0} + :signed-up? {:type :bool + :default false} + :network :string + :networks {:type :list + :objectType :network} + :bootnodes {:type :list + :objectType :bootnode} + :last-request {:type :int :optional true} + :settings {:type :string} + :sharing-usage-data? {:type :bool :default false} + :dev-mode? {:type :bool :default false} + :seed-backed-up? {:type :bool :default false} + :wallet-set-up-passed? {:type :bool + :default false} + :mainnet-warning-shown? {:type :bool + :default false}}}) + +(def v7 {:name :account + :primaryKey :address + :properties {:address :string + :public-key :string + :name {:type :string :optional true} + :email {:type :string :optional true} + :status {:type :string :optional true} + :debug? {:type :bool :default false} + :photo-path :string + :signing-phrase {:type :string} + :mnemonic {:type :string :optional true} + :last-updated {:type :int :default 0} + :last-sign-in {:type :int :default 0} + :signed-up? {:type :bool + :default false} + :network :string + :networks {:type :list + :objectType :network} + :bootnodes {:type :list + :objectType :bootnode} + :last-request {:type :int :optional true} + :settings {:type :string} + :dev-mode? {:type :bool :default false} + :seed-backed-up? {:type :bool :default false} + :wallet-set-up-passed? {:type :bool + :default false} + :mainnet-warning-shown? {:type :bool + :default false}}}) + +;;NOTE(yenda): this was a mistake made because of the previous +;;way realm migrations were specified +(def v8 v4) + +(def v10 {:name :account + :primaryKey :address + :properties {:address :string + :public-key :string + :name {:type :string :optional true} + :email {:type :string :optional true} + :status {:type :string :optional true} + :debug? {:type :bool :default false} + :photo-path :string + :signing-phrase {:type :string} + :mnemonic {:type :string :optional true} + :last-updated {:type :int :default 0} + :last-sign-in {:type :int :default 0} + :signed-up? {:type :bool + :default false} + :network :string + :networks {:type :list + :objectType :network} + :bootnodes {:type :list + :objectType :bootnode} + :last-request {:type :int :optional true} + :settings {:type :string} + :dev-mode? {:type :bool :default false} + :seed-backed-up? {:type :bool :default false} + :wallet-set-up-passed? {:type :bool + :default false} + :mainnet-warning-shown? {:type :bool + :default false}}}) + +(def v11 (assoc-in v10 + [:properties :installation-id] + {:type :string})) diff --git a/src/status_im/data_store/realm/schemas/base/bootnode.cljs b/src/status_im/data_store/realm/schemas/base/bootnode.cljs new file mode 100644 index 0000000000..d26216d686 --- /dev/null +++ b/src/status_im/data_store/realm/schemas/base/bootnode.cljs @@ -0,0 +1,8 @@ +(ns status-im.data-store.realm.schemas.base.bootnode) + +(def v4 {:name :bootnode + :primaryKey :id + :properties {:id :string + :name {:type :string} + :chain {:type :string} + :address {:type :string}}}) diff --git a/src/status_im/data_store/realm/schemas/base/core.cljs b/src/status_im/data_store/realm/schemas/base/core.cljs index 08e53a455e..75c0f0366e 100644 --- a/src/status_im/data_store/realm/schemas/base/core.cljs +++ b/src/status_im/data_store/realm/schemas/base/core.cljs @@ -1,47 +1,77 @@ (ns status-im.data-store.realm.schemas.base.core - (:require [status-im.data-store.realm.schemas.base.v1.core :as v1] - [status-im.data-store.realm.schemas.base.v2.core :as v2] - [status-im.data-store.realm.schemas.base.v3.core :as v3] - [status-im.data-store.realm.schemas.base.v4.core :as v4] - [status-im.data-store.realm.schemas.base.v5.core :as v5] - [status-im.data-store.realm.schemas.base.v6.core :as v6] - [status-im.data-store.realm.schemas.base.v7.core :as v7] - [status-im.data-store.realm.schemas.base.v8.core :as v8] - [status-im.data-store.realm.schemas.base.v9.core :as v9] - [status-im.data-store.realm.schemas.base.v10.core :as v10] - [status-im.data-store.realm.schemas.base.v11.core :as v11])) + (:require [status-im.data-store.realm.schemas.base.network :as network] + [status-im.data-store.realm.schemas.base.account :as account] + [status-im.data-store.realm.schemas.base.bootnode :as bootnode] + [status-im.data-store.realm.schemas.base.migrations :as migrations])) + +(def v1 [network/v1 + account/v1]) + +(def v2 [network/v1 + account/v2]) + +(def v3 [network/v1 + account/v3]) + +(def v4 [network/v1 + bootnode/v4 + account/v4]) + +(def v5 v4) + +(def v6 [network/v1 + bootnode/v4 + account/v6]) + +(def v7 [network/v1 + bootnode/v4 + account/v7]) + +(def v8 [network/v1 + bootnode/v4 + account/v8]) + +(def v9 v8) + +(def v10 [network/v1 + bootnode/v4 + account/v10]) + +(def v11 [network/v1 + bootnode/v4 + account/v11]) ;; put schemas ordered by version -(def schemas [{:schema v1/schema +(def schemas [{:schema v1 :schemaVersion 1 - :migration v1/migration} - {:schema v2/schema + :migration migrations/v1} + {:schema v2 :schemaVersion 2 - :migration v2/migration} - {:schema v3/schema + :migration migrations/v2} + {:schema v3 :schemaVersion 3 - :migration v3/migration} - {:schema v4/schema + :migration migrations/v3} + {:schema v4 :schemaVersion 4 - :migration v4/migration} - {:schema v5/schema + :migration migrations/v4} + {:schema v5 :schemaVersion 5 - :migration v5/migration} - {:schema v6/schema + :migration migrations/v5} + {:schema v6 :schemaVersion 6 - :migration v6/migration} - {:schema v7/schema + :migration migrations/v6} + {:schema v7 :schemaVersion 7 - :migration v7/migration} - {:schema v8/schema + :migration migrations/v7} + {:schema v8 :schemaVersion 8 - :migration v8/migration} - {:schema v9/schema + :migration migrations/v8} + {:schema v9 :schemaVersion 9 - :migration v9/migration} - {:schema v10/schema + :migration migrations/v9} + {:schema v10 :schemaVersion 10 - :migration v10/migration} - {:schema v11/schema + :migration migrations/v10} + {:schema v11 :schemaVersion 11 - :migration v11/migration}]) + :migration migrations/v11}]) diff --git a/src/status_im/data_store/realm/schemas/base/migrations.cljs b/src/status_im/data_store/realm/schemas/base/migrations.cljs new file mode 100644 index 0000000000..2e2b0b8f79 --- /dev/null +++ b/src/status_im/data_store/realm/schemas/base/migrations.cljs @@ -0,0 +1,89 @@ +(ns status-im.data-store.realm.schemas.base.migrations + (:require [taoensso.timbre :as log] + [cognitect.transit :as transit] + [clojure.set :as set] + [clojure.string :as string] + [status-im.utils.random :as random])) + +(def reader (transit/reader :json)) +(def writer (transit/writer :json)) + +(defn serialize [o] (transit/write writer o)) +(defn deserialize [o] (try (transit/read reader o) (catch :default e nil))) + +(defn v1 [old-realm new-realm] + (log/debug "migrating base database v1: " old-realm new-realm)) + +(defn v2 [old-realm new-realm] + (log/debug "migrating base database v2: " old-realm new-realm)) + +(defn v3 [old-realm new-realm] + (log/debug "migrating base database v3: " old-realm new-realm)) + +(defn v4 [old-realm new-realm] + (log/debug "migrating base database v4: " old-realm new-realm)) + +(def removed-tokens-v5 + #{:ATMChain :Centra :ROL}) + +(def removed-fiat-currencies + #{:bmd :bzd :gmd :gyd :kyd :lak :lrd :ltl :mkd :mnt :nio :sos :srd :yer}) + +(defn v5 [old-realm new-realm] + (log/debug "migrating accounts schema v4") + (let [accounts (.objects new-realm "account")] + (dotimes [i (.-length accounts)] + (let [account (aget accounts i) + old-settings (deserialize (aget account "settings")) + new-settings (-> old-settings + (update-in [:wallet :visible-tokens :mainnet] + #(set/difference % removed-tokens-v5)) + (update-in [:wallet :currency] + #(if (removed-fiat-currencies %) :usd %))) + updated (serialize new-settings)] + (aset account "settings" updated))))) + +(defn v6 [old-realm new-realm] + (log/debug "migrating base database v6: " old-realm new-realm)) + +(defn v7 [old-realm new-realm] + (log/debug "migrating base database v7: " old-realm new-realm)) + +(def removed-tokens-v8 + #{:ATT}) + +(defn v8 [old-realm new-realm] + (log/debug "migrating accounts schema v8") + (let [accounts (.objects new-realm "account")] + (dotimes [i (.-length accounts)] + (let [account (aget accounts i) + old-settings (deserialize (aget account "settings")) + new-settings (-> old-settings + (update-in [:wallet :visible-tokens :testnet] + #(set/difference % removed-tokens-v8))) + updated (serialize new-settings)] + (aset account "settings" updated))))) + +(defn v9 [old-realm new-realm] + (log/debug "migrating accounts schema v9") + (let [accounts (.objects new-realm "account")] + (dotimes [i (.-length accounts)] + (let [account (aget accounts i) + old-settings (deserialize (aget account "settings")) + new-settings (-> old-settings + (dissoc :wnode)) + updated (serialize new-settings)] + (aset account "settings" updated))))) + +(defn v10 [old-realm new-realm] + (log/debug "migrating base database v10: " old-realm new-realm)) + +(defn v11 [old-realm new-realm] + (log/debug "migrating accounts schema v11") + (let [accounts (.objects new-realm "account")] + (dotimes [i (.-length accounts)] + (let [account (aget accounts i) + old-installation-id (aget account "installation-id") + installation-id (random/guid)] + (when (string/blank? old-installation-id) + (aset account "installation-id" installation-id)))))) diff --git a/src/status_im/data_store/realm/schemas/base/network.cljs b/src/status_im/data_store/realm/schemas/base/network.cljs new file mode 100644 index 0000000000..5c21dc9d71 --- /dev/null +++ b/src/status_im/data_store/realm/schemas/base/network.cljs @@ -0,0 +1,11 @@ +(ns status-im.data-store.realm.schemas.base.network) + +(def v1 {:name :network + :primaryKey :id + :properties {:id :string + :name {:type :string + :optional true} + :config {:type :string + :optional true} + :rpc-url {:type :string + :optional true}}}) diff --git a/src/status_im/data_store/realm/schemas/base/v1/account.cljs b/src/status_im/data_store/realm/schemas/base/v1/account.cljs deleted file mode 100644 index 29387dcf69..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v1/account.cljs +++ /dev/null @@ -1,25 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v1.account) - -(def schema {:name :account - :primaryKey :address - :properties {:address :string - :public-key :string - :name {:type :string :optional true} - :email {:type :string :optional true} - :status {:type :string :optional true} - :debug? {:type :bool :default false} - :photo-path :string - :signing-phrase {:type :string} - :mnemonic {:type :string} - :last-updated {:type :int :default 0} - :last-sign-in {:type :int :default 0} - :signed-up? {:type :bool - :default false} - :network :string - :networks {:type :list - :objectType :network} - :settings {:type :string} - :sharing-usage-data? {:type :bool :default false} - :dev-mode? {:type :bool :default false} - :seed-backed-up? {:type :bool :default false} - :wallet-set-up-passed? {:type :bool :default false}}}) diff --git a/src/status_im/data_store/realm/schemas/base/v1/core.cljs b/src/status_im/data_store/realm/schemas/base/v1/core.cljs deleted file mode 100644 index 4c162a81cd..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v1/core.cljs +++ /dev/null @@ -1,10 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v1.core - (:require [status-im.data-store.realm.schemas.base.v1.network :as network] - [status-im.data-store.realm.schemas.base.v1.account :as account] - [taoensso.timbre :as log])) - -(def schema [network/schema - account/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating base database v1: " old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/base/v1/network.cljs b/src/status_im/data_store/realm/schemas/base/v1/network.cljs deleted file mode 100644 index 6c297f3b89..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v1/network.cljs +++ /dev/null @@ -1,12 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v1.network - (:require [taoensso.timbre :as log])) - -(def schema {:name :network - :primaryKey :id - :properties {:id :string - :name {:type :string - :optional true} - :config {:type :string - :optional true} - :rpc-url {:type :string - :optional true}}}) diff --git a/src/status_im/data_store/realm/schemas/base/v10/account.cljs b/src/status_im/data_store/realm/schemas/base/v10/account.cljs deleted file mode 100644 index 64e1932906..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v10/account.cljs +++ /dev/null @@ -1,30 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v10.account) - -(def schema {:name :account - :primaryKey :address - :properties {:address :string - :public-key :string - :name {:type :string :optional true} - :email {:type :string :optional true} - :status {:type :string :optional true} - :debug? {:type :bool :default false} - :photo-path :string - :signing-phrase {:type :string} - :mnemonic {:type :string :optional true} - :last-updated {:type :int :default 0} - :last-sign-in {:type :int :default 0} - :signed-up? {:type :bool - :default false} - :network :string - :networks {:type :list - :objectType :network} - :bootnodes {:type :list - :objectType :bootnode} - :last-request {:type :int :optional true} - :settings {:type :string} - :dev-mode? {:type :bool :default false} - :seed-backed-up? {:type :bool :default false} - :wallet-set-up-passed? {:type :bool - :default false} - :mainnet-warning-shown? {:type :bool - :default false}}}) diff --git a/src/status_im/data_store/realm/schemas/base/v10/core.cljs b/src/status_im/data_store/realm/schemas/base/v10/core.cljs deleted file mode 100644 index 3bddfdb2eb..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v10/core.cljs +++ /dev/null @@ -1,12 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v10.core - (:require [status-im.data-store.realm.schemas.base.v1.network :as network] - [status-im.data-store.realm.schemas.base.v4.bootnode :as bootnode] - [status-im.data-store.realm.schemas.base.v10.account :as account] - [taoensso.timbre :as log])) - -(def schema [network/schema - bootnode/schema - account/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating base database v10: " old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/base/v11/account.cljs b/src/status_im/data_store/realm/schemas/base/v11/account.cljs deleted file mode 100644 index c3c56221cf..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v11/account.cljs +++ /dev/null @@ -1,22 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v11.account - (:require [taoensso.timbre :as log] - [clojure.string :as string] - [cognitect.transit :as transit] - [clojure.set :as set] - [status-im.utils.random :as random] - [status-im.data-store.realm.schemas.base.v10.account :as v10])) - -(def schema - (assoc-in v10/schema - [:properties :installation-id] - {:type :string})) - -(defn migration [old-realm new-realm] - (log/debug "migrating accounts schema v11") - (let [accounts (.objects new-realm "account")] - (dotimes [i (.-length accounts)] - (let [account (aget accounts i) - old-installation-id (aget account "installation-id") - installation-id (random/guid)] - (when (string/blank? old-installation-id) - (aset account "installation-id" installation-id)))))) diff --git a/src/status_im/data_store/realm/schemas/base/v11/core.cljs b/src/status_im/data_store/realm/schemas/base/v11/core.cljs deleted file mode 100644 index dc64182438..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v11/core.cljs +++ /dev/null @@ -1,13 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v11.core - (:require [status-im.data-store.realm.schemas.base.v1.network :as network] - [status-im.data-store.realm.schemas.base.v4.bootnode :as bootnode] - [status-im.data-store.realm.schemas.base.v11.account :as account] - [taoensso.timbre :as log])) - -(def schema [network/schema - bootnode/schema - account/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating base database v11: " old-realm new-realm) - (account/migration old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/base/v2/account.cljs b/src/status_im/data_store/realm/schemas/base/v2/account.cljs deleted file mode 100644 index c443465624..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v2/account.cljs +++ /dev/null @@ -1,26 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v2.account) - -(def schema {:name :account - :primaryKey :address - :properties {:address :string - :public-key :string - :name {:type :string :optional true} - :email {:type :string :optional true} - :status {:type :string :optional true} - :debug? {:type :bool :default false} - :photo-path :string - :signing-phrase {:type :string} - :mnemonic {:type :string :optional true} - :last-updated {:type :int :default 0} - :last-sign-in {:type :int :default 0} - :signed-up? {:type :bool - :default false} - :network :string - :networks {:type :list - :objectType :network} - :settings {:type :string} - :sharing-usage-data? {:type :bool :default false} - :dev-mode? {:type :bool :default false} - :seed-backed-up? {:type :bool :default false} - :wallet-set-up-passed? {:type :bool - :default false}}}) diff --git a/src/status_im/data_store/realm/schemas/base/v2/core.cljs b/src/status_im/data_store/realm/schemas/base/v2/core.cljs deleted file mode 100644 index 742a73abc8..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v2/core.cljs +++ /dev/null @@ -1,10 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v2.core - (:require [status-im.data-store.realm.schemas.base.v1.network :as network] - [status-im.data-store.realm.schemas.base.v2.account :as account] - [taoensso.timbre :as log])) - -(def schema [network/schema - account/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating base database v2: " old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/base/v3/account.cljs b/src/status_im/data_store/realm/schemas/base/v3/account.cljs deleted file mode 100644 index 532314ada0..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v3/account.cljs +++ /dev/null @@ -1,27 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v3.account) - -(def schema {:name :account - :primaryKey :address - :properties {:address :string - :public-key :string - :name {:type :string :optional true} - :email {:type :string :optional true} - :status {:type :string :optional true} - :debug? {:type :bool :default false} - :photo-path :string - :signing-phrase {:type :string} - :mnemonic {:type :string :optional true} - :last-updated {:type :int :default 0} - :last-sign-in {:type :int :default 0} - :signed-up? {:type :bool - :default false} - :network :string - :networks {:type :list - :objectType :network} - :last-request {:type :int :optional true} - :settings {:type :string} - :sharing-usage-data? {:type :bool :default false} - :dev-mode? {:type :bool :default false} - :seed-backed-up? {:type :bool :default false} - :wallet-set-up-passed? {:type :bool - :default false}}}) diff --git a/src/status_im/data_store/realm/schemas/base/v3/core.cljs b/src/status_im/data_store/realm/schemas/base/v3/core.cljs deleted file mode 100644 index 3c7ad481d0..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v3/core.cljs +++ /dev/null @@ -1,10 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v3.core - (:require [status-im.data-store.realm.schemas.base.v1.network :as network] - [status-im.data-store.realm.schemas.base.v3.account :as account] - [taoensso.timbre :as log])) - -(def schema [network/schema - account/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating base database v3: " old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/base/v4/account.cljs b/src/status_im/data_store/realm/schemas/base/v4/account.cljs deleted file mode 100644 index a62ff56132..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v4/account.cljs +++ /dev/null @@ -1,29 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v4.account) - -(def schema {:name :account - :primaryKey :address - :properties {:address :string - :public-key :string - :name {:type :string :optional true} - :email {:type :string :optional true} - :status {:type :string :optional true} - :debug? {:type :bool :default false} - :photo-path :string - :signing-phrase {:type :string} - :mnemonic {:type :string :optional true} - :last-updated {:type :int :default 0} - :last-sign-in {:type :int :default 0} - :signed-up? {:type :bool - :default false} - :network :string - :networks {:type :list - :objectType :network} - :bootnodes {:type :list - :objectType :bootnode} - :last-request {:type :int :optional true} - :settings {:type :string} - :sharing-usage-data? {:type :bool :default false} - :dev-mode? {:type :bool :default false} - :seed-backed-up? {:type :bool :default false} - :wallet-set-up-passed? {:type :bool - :default false}}}) diff --git a/src/status_im/data_store/realm/schemas/base/v4/bootnode.cljs b/src/status_im/data_store/realm/schemas/base/v4/bootnode.cljs deleted file mode 100644 index 7975d74735..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v4/bootnode.cljs +++ /dev/null @@ -1,8 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v4.bootnode) - -(def schema {:name :bootnode - :primaryKey :id - :properties {:id :string - :name {:type :string} - :chain {:type :string} - :address {:type :string}}}) diff --git a/src/status_im/data_store/realm/schemas/base/v4/core.cljs b/src/status_im/data_store/realm/schemas/base/v4/core.cljs deleted file mode 100644 index 2202000d67..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v4/core.cljs +++ /dev/null @@ -1,12 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v4.core - (:require [status-im.data-store.realm.schemas.base.v1.network :as network] - [status-im.data-store.realm.schemas.base.v4.account :as account] - [status-im.data-store.realm.schemas.base.v4.bootnode :as bootnode] - [taoensso.timbre :as log])) - -(def schema [network/schema - bootnode/schema - account/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating base database v4: " old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/base/v5/account.cljs b/src/status_im/data_store/realm/schemas/base/v5/account.cljs deleted file mode 100644 index 76cb01b71d..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v5/account.cljs +++ /dev/null @@ -1,33 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v5.account - (:require [taoensso.timbre :as log] - [cognitect.transit :as transit] - [clojure.set :as set] - [status-im.data-store.realm.schemas.base.v4.account :as v4])) - -(def schema v4/schema) - -(def removed-tokens - #{:ATMChain :Centra :ROL}) - -(def removed-fiat-currencies - #{:bmd :bzd :gmd :gyd :kyd :lak :lrd :ltl :mkd :mnt :nio :sos :srd :yer}) - -(def reader (transit/reader :json)) -(def writer (transit/writer :json)) - -(defn serialize [o] (transit/write writer o)) -(defn deserialize [o] (try (transit/read reader o) (catch :default e nil))) - -(defn migration [old-realm new-realm] - (log/debug "migrating accounts schema v4") - (let [accounts (.objects new-realm "account")] - (dotimes [i (.-length accounts)] - (let [account (aget accounts i) - old-settings (deserialize (aget account "settings")) - new-settings (-> old-settings - (update-in [:wallet :visible-tokens :mainnet] - #(set/difference % removed-tokens)) - (update-in [:wallet :currency] - #(if (removed-fiat-currencies %) :usd %))) - updated (serialize new-settings)] - (aset account "settings" updated))))) \ No newline at end of file diff --git a/src/status_im/data_store/realm/schemas/base/v5/core.cljs b/src/status_im/data_store/realm/schemas/base/v5/core.cljs deleted file mode 100644 index bac68ff5fb..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v5/core.cljs +++ /dev/null @@ -1,13 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v5.core - (:require [status-im.data-store.realm.schemas.base.v1.network :as network] - [status-im.data-store.realm.schemas.base.v4.bootnode :as bootnode] - [status-im.data-store.realm.schemas.base.v5.account :as account] - [taoensso.timbre :as log])) - -(def schema [network/schema - bootnode/schema - account/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating base database v5: " old-realm new-realm) - (account/migration old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/base/v6/account.cljs b/src/status_im/data_store/realm/schemas/base/v6/account.cljs deleted file mode 100644 index 4d942c7552..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v6/account.cljs +++ /dev/null @@ -1,31 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v6.account) - -(def schema {:name :account - :primaryKey :address - :properties {:address :string - :public-key :string - :name {:type :string :optional true} - :email {:type :string :optional true} - :status {:type :string :optional true} - :debug? {:type :bool :default false} - :photo-path :string - :signing-phrase {:type :string} - :mnemonic {:type :string :optional true} - :last-updated {:type :int :default 0} - :last-sign-in {:type :int :default 0} - :signed-up? {:type :bool - :default false} - :network :string - :networks {:type :list - :objectType :network} - :bootnodes {:type :list - :objectType :bootnode} - :last-request {:type :int :optional true} - :settings {:type :string} - :sharing-usage-data? {:type :bool :default false} - :dev-mode? {:type :bool :default false} - :seed-backed-up? {:type :bool :default false} - :wallet-set-up-passed? {:type :bool - :default false} - :mainnet-warning-shown? {:type :bool - :default false}}}) diff --git a/src/status_im/data_store/realm/schemas/base/v6/core.cljs b/src/status_im/data_store/realm/schemas/base/v6/core.cljs deleted file mode 100644 index 4beb126af8..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v6/core.cljs +++ /dev/null @@ -1,12 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v6.core - (:require [status-im.data-store.realm.schemas.base.v1.network :as network] - [status-im.data-store.realm.schemas.base.v4.bootnode :as bootnode] - [status-im.data-store.realm.schemas.base.v6.account :as account] - [taoensso.timbre :as log])) - -(def schema [network/schema - bootnode/schema - account/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating base database v6: " old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/base/v7/account.cljs b/src/status_im/data_store/realm/schemas/base/v7/account.cljs deleted file mode 100644 index fdcbaede47..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v7/account.cljs +++ /dev/null @@ -1,30 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v7.account) - -(def schema {:name :account - :primaryKey :address - :properties {:address :string - :public-key :string - :name {:type :string :optional true} - :email {:type :string :optional true} - :status {:type :string :optional true} - :debug? {:type :bool :default false} - :photo-path :string - :signing-phrase {:type :string} - :mnemonic {:type :string :optional true} - :last-updated {:type :int :default 0} - :last-sign-in {:type :int :default 0} - :signed-up? {:type :bool - :default false} - :network :string - :networks {:type :list - :objectType :network} - :bootnodes {:type :list - :objectType :bootnode} - :last-request {:type :int :optional true} - :settings {:type :string} - :dev-mode? {:type :bool :default false} - :seed-backed-up? {:type :bool :default false} - :wallet-set-up-passed? {:type :bool - :default false} - :mainnet-warning-shown? {:type :bool - :default false}}}) diff --git a/src/status_im/data_store/realm/schemas/base/v7/core.cljs b/src/status_im/data_store/realm/schemas/base/v7/core.cljs deleted file mode 100644 index f7b7a23a6b..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v7/core.cljs +++ /dev/null @@ -1,12 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v7.core - (:require [status-im.data-store.realm.schemas.base.v1.network :as network] - [status-im.data-store.realm.schemas.base.v4.bootnode :as bootnode] - [status-im.data-store.realm.schemas.base.v7.account :as account] - [taoensso.timbre :as log])) - -(def schema [network/schema - bootnode/schema - account/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating base database v7: " old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/base/v8/account.cljs b/src/status_im/data_store/realm/schemas/base/v8/account.cljs deleted file mode 100644 index ddde83e521..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v8/account.cljs +++ /dev/null @@ -1,28 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v8.account - (:require [taoensso.timbre :as log] - [cognitect.transit :as transit] - [clojure.set :as set] - [status-im.data-store.realm.schemas.base.v4.account :as v7])) - -(def schema v7/schema) - -(def removed-tokens - #{:ATT}) - -(def reader (transit/reader :json)) -(def writer (transit/writer :json)) - -(defn serialize [o] (transit/write writer o)) -(defn deserialize [o] (try (transit/read reader o) (catch :default e nil))) - -(defn migration [old-realm new-realm] - (log/debug "migrating accounts schema v8") - (let [accounts (.objects new-realm "account")] - (dotimes [i (.-length accounts)] - (let [account (aget accounts i) - old-settings (deserialize (aget account "settings")) - new-settings (-> old-settings - (update-in [:wallet :visible-tokens :testnet] - #(set/difference % removed-tokens))) - updated (serialize new-settings)] - (aset account "settings" updated))))) \ No newline at end of file diff --git a/src/status_im/data_store/realm/schemas/base/v8/core.cljs b/src/status_im/data_store/realm/schemas/base/v8/core.cljs deleted file mode 100644 index 005edddf72..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v8/core.cljs +++ /dev/null @@ -1,13 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v8.core - (:require [status-im.data-store.realm.schemas.base.v1.network :as network] - [status-im.data-store.realm.schemas.base.v4.bootnode :as bootnode] - [status-im.data-store.realm.schemas.base.v8.account :as account] - [taoensso.timbre :as log])) - -(def schema [network/schema - bootnode/schema - account/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating base database v8: " old-realm new-realm) - (account/migration old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/base/v9/account.cljs b/src/status_im/data_store/realm/schemas/base/v9/account.cljs deleted file mode 100644 index 6b731d1eac..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v9/account.cljs +++ /dev/null @@ -1,24 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v9.account - (:require [taoensso.timbre :as log] - [cognitect.transit :as transit] - [clojure.set :as set] - [status-im.data-store.realm.schemas.base.v8.account :as v8])) - -(def schema v8/schema) - -(def reader (transit/reader :json)) -(def writer (transit/writer :json)) - -(defn serialize [o] (transit/write writer o)) -(defn deserialize [o] (try (transit/read reader o) (catch :default e nil))) - -(defn migration [old-realm new-realm] - (log/debug "migrating accounts schema v9") - (let [accounts (.objects new-realm "account")] - (dotimes [i (.-length accounts)] - (let [account (aget accounts i) - old-settings (deserialize (aget account "settings")) - new-settings (-> old-settings - (dissoc :wnode)) - updated (serialize new-settings)] - (aset account "settings" updated))))) diff --git a/src/status_im/data_store/realm/schemas/base/v9/core.cljs b/src/status_im/data_store/realm/schemas/base/v9/core.cljs deleted file mode 100644 index 5b44b3eb4c..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v9/core.cljs +++ /dev/null @@ -1,13 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v9.core - (:require [status-im.data-store.realm.schemas.base.v1.network :as network] - [status-im.data-store.realm.schemas.base.v4.bootnode :as bootnode] - [status-im.data-store.realm.schemas.base.v9.account :as account] - [taoensso.timbre :as log])) - -(def schema [network/schema - bootnode/schema - account/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating base database v9: " old-realm new-realm) - (account/migration old-realm new-realm))