From d9eca279d04e6ca88e2c904e9926ab9787da99b9 Mon Sep 17 00:00:00 2001 From: Eric Dvorsak Date: Fri, 6 Apr 2018 19:05:15 +0200 Subject: [PATCH] Remove migrations as they are not needed anymore because of breaking change Signed-off-by: Eric Dvorsak --- src/status_im/data_store/core.cljs | 2 +- src/status_im/data_store/discover.cljs | 33 ---- src/status_im/data_store/realm/discover.cljs | 39 ----- .../realm/schemas/account/core.cljs | 93 +---------- .../schemas/account/{v21 => v1}/browser.cljs | 2 +- .../realm/schemas/account/v1/chat.cljs | 21 +-- .../schemas/account/v1/chat_contact.cljs | 3 - .../realm/schemas/account/v1/command.cljs | 10 -- .../realm/schemas/account/v1/contact.cljs | 45 ++--- .../account/{v5 => v1}/contact_group.cljs | 5 +- .../realm/schemas/account/v1/core.cljs | 43 ++--- .../realm/schemas/account/v1/discover.cljs | 16 -- .../schemas/account/v1/group_contact.cljs | 5 + .../realm/schemas/account/v1/kv_store.cljs | 10 -- .../account/{v8 => v1}/local_storage.cljs | 2 +- .../realm/schemas/account/v1/message.cljs | 60 +++---- .../schemas/account/v1/pending_message.cljs | 22 --- .../schemas/account/v1/processed_message.cljs | 13 -- .../realm/schemas/account/v1/request.cljs | 11 +- .../realm/schemas/account/v1/tag.cljs | 10 -- .../account/{v22 => v1}/transport.cljs | 2 +- .../realm/schemas/account/v1/user_status.cljs | 20 +-- .../realm/schemas/account/v10/core.cljs | 39 ----- .../realm/schemas/account/v10/message.cljs | 52 ------ .../realm/schemas/account/v11/chat.cljs | 50 ------ .../realm/schemas/account/v11/core.cljs | 39 ----- .../realm/schemas/account/v12/core.cljs | 39 ----- .../schemas/account/v12/pending_message.cljs | 37 ----- .../realm/schemas/account/v13/core.cljs | 40 ----- .../schemas/account/v13/handler_data.cljs | 8 - .../realm/schemas/account/v14/contact.cljs | 34 ---- .../realm/schemas/account/v14/core.cljs | 40 ----- .../realm/schemas/account/v15/contact.cljs | 47 ------ .../realm/schemas/account/v15/core.cljs | 41 ----- .../realm/schemas/account/v15/request.cljs | 15 -- .../realm/schemas/account/v16/contact.cljs | 33 ---- .../realm/schemas/account/v16/core.cljs | 74 --------- .../realm/schemas/account/v17/core.cljs | 92 ---------- .../realm/schemas/account/v18/core.cljs | 41 ----- .../schemas/account/v18/pending_message.cljs | 26 --- .../realm/schemas/account/v19/chat.cljs | 39 ----- .../realm/schemas/account/v19/contact.cljs | 30 ---- .../realm/schemas/account/v19/core.cljs | 157 ------------------ .../realm/schemas/account/v19/message.cljs | 30 ---- .../realm/schemas/account/v19/request.cljs | 8 - .../schemas/account/v19/user_status.cljs | 12 -- .../realm/schemas/account/v2/chat.cljs | 38 ----- .../realm/schemas/account/v2/contact.cljs | 26 --- .../realm/schemas/account/v2/core.cljs | 32 ---- .../realm/schemas/account/v20/core.cljs | 31 ---- .../realm/schemas/account/v20/discover.cljs | 14 -- .../realm/schemas/account/v21/chat.cljs | 37 ----- .../realm/schemas/account/v21/core.cljs | 97 ----------- .../realm/schemas/account/v22/chat.cljs | 37 ----- .../realm/schemas/account/v22/core.cljs | 36 ---- .../realm/schemas/account/v23/chat.cljs | 35 ---- .../realm/schemas/account/v23/contact.cljs | 28 ---- .../realm/schemas/account/v23/core.cljs | 62 ------- .../realm/schemas/account/v23/message.cljs | 30 ---- .../realm/schemas/account/v3/chat.cljs | 40 ----- .../realm/schemas/account/v3/contact.cljs | 28 ---- .../realm/schemas/account/v3/core.cljs | 32 ---- .../realm/schemas/account/v4/chat.cljs | 42 ----- .../realm/schemas/account/v4/core.cljs | 32 ---- .../realm/schemas/account/v4/message.cljs | 38 ----- .../realm/schemas/account/v5/core.cljs | 36 ---- .../schemas/account/v5/group_contact.cljs | 8 - .../realm/schemas/account/v6/command.cljs | 26 --- .../schemas/account/v6/command_parameter.cljs | 9 - .../realm/schemas/account/v6/contact.cljs | 47 ------ .../realm/schemas/account/v6/core.cljs | 38 ----- .../realm/schemas/account/v7/contact.cljs | 47 ------ .../realm/schemas/account/v7/core.cljs | 37 ----- .../schemas/account/v7/pending_message.cljs | 27 --- .../realm/schemas/account/v8/core.cljs | 38 ----- .../schemas/account/v9/command_parameter.cljs | 8 - .../realm/schemas/account/v9/core.cljs | 50 ------ .../data_store/realm/schemas/base/core.cljs | 36 +--- .../realm/schemas/base/v1/account.cljs | 24 +-- .../realm/schemas/base/v1/core.cljs | 12 +- .../realm/schemas/base/v1/kv_store.cljs | 10 -- .../schemas/base/{v4 => v1}/network.cljs | 5 +- .../realm/schemas/base/v2/account.cljs | 25 --- .../realm/schemas/base/v2/core.cljs | 13 -- .../realm/schemas/base/v3/account.cljs | 35 ---- .../realm/schemas/base/v3/core.cljs | 12 -- .../realm/schemas/base/v4/account.cljs | 32 ---- .../realm/schemas/base/v4/core.cljs | 14 -- .../realm/schemas/base/v5/account.cljs | 29 ---- .../realm/schemas/base/v5/core.cljs | 13 -- .../realm/schemas/base/v6/account.cljs | 33 ---- .../realm/schemas/base/v6/core.cljs | 11 -- .../realm/schemas/base/v7/account.cljs | 26 --- .../realm/schemas/base/v7/core.cljs | 10 -- .../realm/schemas/base/v8/account.cljs | 29 ---- .../realm/schemas/base/v8/core.cljs | 10 -- .../realm/schemas/base/v9/account.cljs | 25 --- .../realm/schemas/base/v9/core.cljs | 10 -- 98 files changed, 120 insertions(+), 2870 deletions(-) delete mode 100644 src/status_im/data_store/discover.cljs delete mode 100644 src/status_im/data_store/realm/discover.cljs rename src/status_im/data_store/realm/schemas/account/{v21 => v1}/browser.cljs (90%) delete mode 100644 src/status_im/data_store/realm/schemas/account/v1/command.cljs rename src/status_im/data_store/realm/schemas/account/{v5 => v1}/contact_group.cljs (78%) delete mode 100644 src/status_im/data_store/realm/schemas/account/v1/discover.cljs create 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/kv_store.cljs rename src/status_im/data_store/realm/schemas/account/{v8 => v1}/local_storage.cljs (78%) delete mode 100644 src/status_im/data_store/realm/schemas/account/v1/pending_message.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v1/processed_message.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v1/tag.cljs rename src/status_im/data_store/realm/schemas/account/{v22 => v1}/transport.cljs (91%) 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/v10/message.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v11/chat.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/v12/core.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v12/pending_message.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v13/core.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v13/handler_data.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v14/contact.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v14/core.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v15/contact.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v15/core.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v15/request.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v16/contact.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v16/core.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v17/core.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v18/core.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v18/pending_message.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v19/chat.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v19/contact.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v19/core.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v19/message.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v19/request.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v19/user_status.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v2/chat.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v2/contact.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/v20/core.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v20/discover.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v21/chat.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v21/core.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v22/chat.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v22/core.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v23/chat.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v23/contact.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v23/core.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v23/message.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/contact.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/chat.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/message.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/v5/group_contact.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v6/command.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v6/command_parameter.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v6/contact.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/v7/contact.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/pending_message.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/command_parameter.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/base/v1/kv_store.cljs rename src/status_im/data_store/realm/schemas/base/{v4 => v1}/network.cljs (77%) 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/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/core.cljs b/src/status_im/data_store/core.cljs index 91f316fdba..930c94d4e0 100644 --- a/src/status_im/data_store/core.cljs +++ b/src/status_im/data_store/core.cljs @@ -1,6 +1,6 @@ (ns status-im.data-store.core (:require status-im.data-store.chats - status-im.data-store.messages + status-im.data-store.messages status-im.data-store.contacts status-im.data-store.transport status-im.data-store.browser diff --git a/src/status_im/data_store/discover.cljs b/src/status_im/data_store/discover.cljs deleted file mode 100644 index 8d60d7f948..0000000000 --- a/src/status_im/data_store/discover.cljs +++ /dev/null @@ -1,33 +0,0 @@ -(ns status-im.data-store.discover - (:require [re-frame.core :as re-frame] - [status-im.data-store.realm.discover :as data-store] - [status-im.utils.handlers :as handlers])) - -;; stores a collection of discover messages -;; removes the tags from the discovers because there is no -;; need to store them and realm doesn't support lists -;; of string -;; also deletes the oldest queries if the number of discovers stored is -;; above maximum-number-of-discoveries -(re-frame/reg-fx - :data-store/save-all-discoveries - (fn [[discovers maximum-number-of-discoveries]] - (data-store/save-all (mapv #(dissoc % :tags) discovers)) - (data-store/delete :created-at :asc maximum-number-of-discoveries))) - -(defn get-all - ;; extracts the hashtags from the status and put them into a set - ;; for each discover - ;; returns a map of discovers that can be used as is in the app-db - [] - (reduce (fn [acc {:keys [message-id status] :as discover}] - (let [tags (handlers/get-hashtags status) - discover (assoc discover :tags tags)] - (assoc acc message-id discover))) - {} - (data-store/get-all-as-list :asc))) - -(re-frame/reg-cofx - :data-store/discoveries - (fn [cofx _] - (assoc cofx :data-store/discoveries (get-all)))) diff --git a/src/status_im/data_store/realm/discover.cljs b/src/status_im/data_store/realm/discover.cljs deleted file mode 100644 index 9c885024f3..0000000000 --- a/src/status_im/data_store/realm/discover.cljs +++ /dev/null @@ -1,39 +0,0 @@ -(ns status-im.data-store.realm.discover - (:require [status-im.data-store.realm.core :as realm] - [taoensso.timbre :as log]) - (:refer-clojure :exclude [exists?])) - -(defn get-all - [ordering] - (-> @realm/account-realm - (realm/get-all :discover) - (realm/sorted :created-at ordering))) - -(defn get-all-as-list - [ordering] - (realm/js-object->clj (get-all ordering))) - -(defn save - [discover] - (realm/write @realm/account-realm - #(realm/create @realm/account-realm :discover discover true))) - -(defn save-all - [discoveries] - (realm/write @realm/account-realm - (fn [] - (doseq [discover discoveries] - (realm/create @realm/account-realm :discover discover true))))) - -(defn delete - [by ordering max-count] - (let [discoveries (realm/get-all @realm/account-realm :discover) - count (realm/get-count discoveries)] - (if (> count max-count) - (let [to-delete (-> discoveries - (realm/sorted by ordering) - (realm/page 0 (- max-count count)))] - (realm/write @realm/account-realm - (fn [] - (log/debug (str "Deleting " (realm/get-count to-delete) " discoveries")) - (realm/delete @realm/account-realm to-delete))))))) 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 981db10565..21b6cd6bee 100644 --- a/src/status_im/data_store/realm/schemas/account/core.cljs +++ b/src/status_im/data_store/realm/schemas/account/core.cljs @@ -1,98 +1,9 @@ (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] - [status-im.data-store.realm.schemas.account.v12.core :as v12] - [status-im.data-store.realm.schemas.account.v13.core :as v13] - [status-im.data-store.realm.schemas.account.v14.core :as v14] - [status-im.data-store.realm.schemas.account.v15.core :as v15] - [status-im.data-store.realm.schemas.account.v16.core :as v16] - [status-im.data-store.realm.schemas.account.v17.core :as v17] - [status-im.data-store.realm.schemas.account.v18.core :as v18] - [status-im.data-store.realm.schemas.account.v19.core :as v19] - [status-im.data-store.realm.schemas.account.v20.core :as v20] - [status-im.data-store.realm.schemas.account.v21.core :as v21] - [status-im.data-store.realm.schemas.account.v22.core :as v22] - [status-im.data-store.realm.schemas.account.v23.core :as v23])) - + (:require [status-im.data-store.realm.schemas.account.v1.core :as v1])) ;; TODO(oskarth): Add failing test if directory vXX exists but isn't in schemas. ;; put schemas ordered by version (def schemas [{:schema v1/schema :schemaVersion 1 - :migration v1/migration} - {:schema v2/schema - :schemaVersion 2 - :migration v2/migration} - {:schema v3/schema - :schemaVersion 3 - :migration v3/migration} - {:schema v4/schema - :schemaVersion 4 - :migration v4/migration} - {:schema v5/schema - :schemaVersion 5 - :migration v5/migration} - {:schema v6/schema - :schemaVersion 6 - :migration v6/migration} - {:schema v7/schema - :schemaVersion 7 - :migration v7/migration} - {:schema v8/schema - :schemaVersion 8 - :migration v8/migration} - {:schema v9/schema - :schemaVersion 9 - :migration v9/migration} - {:schema v10/schema - :schemaVersion 10 - :migration v10/migration} - {:schema v11/schema - :schemaVersion 11 - :migration v11/migration} - {:schema v12/schema - :schemaVersion 12 - :migration v12/migration} - {:schema v13/schema - :schemaVersion 13 - :migration v13/migration} - {:schema v14/schema - :schemaVersion 14 - :migration v14/migration} - {:schema v15/schema - :schemaVersion 15 - :migration v15/migration} - {:schema v16/schema - :schemaVersion 16 - :migration v16/migration} - {:schema v17/schema - :schemaVersion 17 - :migration v17/migration} - {:schema v18/schema - :schemaVersion 18 - :migration v18/migration} - {:schema v19/schema - :schemaVersion 19 - :migration v19/migration} - {:schema v20/schema - :schemaVersion 20 - :migration v20/migration} - {:schema v21/schema - :schemaVersion 21 - :migration v21/migration} - {:schema v22/schema - :schemaVersion 22 - :migration v22/migration} - {:schema v23/schema - :schemaVersion 23 - :migration v23/migration}]) + :migration v1/migration}]) diff --git a/src/status_im/data_store/realm/schemas/account/v21/browser.cljs b/src/status_im/data_store/realm/schemas/account/v1/browser.cljs similarity index 90% rename from src/status_im/data_store/realm/schemas/account/v21/browser.cljs rename to src/status_im/data_store/realm/schemas/account/v1/browser.cljs index 1b4f172f12..aa82ebaba4 100644 --- a/src/status_im/data_store/realm/schemas/account/v21/browser.cljs +++ b/src/status_im/data_store/realm/schemas/account/v1/browser.cljs @@ -1,4 +1,4 @@ -(ns status-im.data-store.realm.schemas.account.v21.browser) +(ns status-im.data-store.realm.schemas.account.v1.browser) (def schema {:name :browser :primaryKey :browser-id 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 index 0dd367e62f..4000ce5186 100644 --- a/src/status_im/data_store/realm/schemas/account/v1/chat.cljs +++ b/src/status_im/data_store/realm/schemas/account/v1/chat.cljs @@ -1,6 +1,5 @@ (ns status-im.data-store.realm.schemas.account.v1.chat - (:require [taoensso.timbre :as log] - [status-im.ui.components.styles :refer [default-chat-color]])) + (:require [status-im.ui.components.styles :refer [default-chat-color]])) (def schema {:name :chat :primaryKey :chat-id @@ -16,6 +15,8 @@ :timestamp :int :contacts {:type :list :objectType :chat-contact} + :unremovable? {:type :bool + :default false} :removed-at {:type :int :optional true} :removed-from-at {:type :int @@ -24,17 +25,11 @@ :optional true} :updated-at {:type :int :optional true} - :last-message-id :string :message-overhead {:type :int :default 0} - :public-key {:type :string - :optional true} - :private-key {:type :string - :optional true} - :pending-contact? {:type :bool - :default false} :contact-info {:type :string - :optional true}}}) - -(defn migration [_ _] - (log/debug "migrating chat schema")) + :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 index aa671873a5..ff56e0d07b 100644 --- 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 @@ -5,6 +5,3 @@ :properties {:identity "string" :is-in-chat {:type "bool" :default true}}}) - -(defn migration [_ _] - (log/debug "migrating chat-contact schema")) diff --git a/src/status_im/data_store/realm/schemas/account/v1/command.cljs b/src/status_im/data_store/realm/schemas/account/v1/command.cljs deleted file mode 100644 index cfbab8f882..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v1/command.cljs +++ /dev/null @@ -1,10 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v1.command - (:require [taoensso.timbre :as log])) - -(def schema {:name :command - :primaryKey :chat-id - :properties {:chat-id "string" - :file "string"}}) - -(defn migration [_ _] - (log/debug "migrating command schema")) 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 index 9c5b4c7eb7..c42f8e2303 100644 --- a/src/status_im/data_store/realm/schemas/account/v1/contact.cljs +++ b/src/status_im/data_store/realm/schemas/account/v1/contact.cljs @@ -3,25 +3,26 @@ (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} - :status {:type "string" :optional true} - :public-key {:type :string - :optional true} - :private-key {:type :string - :optional true} - :keys-last-updated {:type "int" :default 0} - :dapp? {:type :bool - :default false} - :dapp-url {:type :string - :optional true} - :dapp-hash {:type :int - :optional true}}}) - -(defn migration [_ _] - (log/debug "migrating contact schema")) + :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/v5/contact_group.cljs b/src/status_im/data_store/realm/schemas/account/v1/contact_group.cljs similarity index 78% rename from src/status_im/data_store/realm/schemas/account/v5/contact_group.cljs rename to src/status_im/data_store/realm/schemas/account/v1/contact_group.cljs index c1e4d6eee6..24d64708bf 100644 --- a/src/status_im/data_store/realm/schemas/account/v5/contact_group.cljs +++ b/src/status_im/data_store/realm/schemas/account/v1/contact_group.cljs @@ -1,4 +1,4 @@ -(ns status-im.data-store.realm.schemas.account.v5.contact-group +(ns status-im.data-store.realm.schemas.account.v1.contact-group (:require [taoensso.timbre :as log])) (def schema {:name :contact-group @@ -10,6 +10,3 @@ :pending? {:type :bool :default false} :contacts {:type :list :objectType :group-contact}}}) - -(defn migration [old-realm new-realm] - (log/debug "migrating group schema v5")) 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 index 6e4732349c..5395941879 100644 --- a/src/status_im/data_store/realm/schemas/account/v1/core.cljs +++ b/src/status_im/data_store/realm/schemas/account/v1/core.cljs @@ -1,42 +1,31 @@ (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.chat-contact :as chat-contact] - [status-im.data-store.realm.schemas.account.v1.command :as command] [status-im.data-store.realm.schemas.account.v1.contact :as contact] - [status-im.data-store.realm.schemas.account.v1.discover :as discover] - [status-im.data-store.realm.schemas.account.v1.kv-store :as kv-store] [status-im.data-store.realm.schemas.account.v1.message :as message] - [status-im.data-store.realm.schemas.account.v1.pending-message :as pending-message] - [status-im.data-store.realm.schemas.account.v1.processed-message :as processed-message] [status-im.data-store.realm.schemas.account.v1.request :as request] - [status-im.data-store.realm.schemas.account.v1.tag :as tag] [status-im.data-store.realm.schemas.account.v1.user-status :as user-status] - [taoensso.timbre :as log])) + [status-im.data-store.realm.schemas.account.v1.contact-group :as contact-group] + [status-im.data-store.realm.schemas.account.v1.group-contact :as group-contact] + [status-im.data-store.realm.schemas.account.v1.local-storage :as local-storage] + [status-im.data-store.realm.schemas.account.v1.browser :as browser] + [goog.object :as object] + [taoensso.timbre :as log] + [cljs.reader :as reader] + [clojure.string :as string])) (def schema [chat/schema chat-contact/schema - command/schema + transport/schema contact/schema - discover/schema - kv-store/schema message/schema - pending-message/schema - processed-message/schema request/schema - tag/schema - user-status/schema]) + user-status/schema + contact-group/schema + group-contact/schema + local-storage/schema + browser/schema]) (defn migration [old-realm new-realm] - (log/debug "migrating v1 account database: " old-realm new-realm) - (chat/migration old-realm new-realm) - (chat-contact/migration old-realm new-realm) - (command/migration old-realm new-realm) - (contact/migration old-realm new-realm) - (discover/migration old-realm new-realm) - (kv-store/migration old-realm new-realm) - (message/migration old-realm new-realm) - (pending-message/migration old-realm new-realm) - (processed-message/migration old-realm new-realm) - (request/migration old-realm new-realm) - (tag/migration old-realm new-realm) - (user-status/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/discover.cljs b/src/status_im/data_store/realm/schemas/account/v1/discover.cljs deleted file mode 100644 index e11ddaf18f..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v1/discover.cljs +++ /dev/null @@ -1,16 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v1.discover - (:require [taoensso.timbre :as log])) - -(def schema {:name :discover - :primaryKey :message-id - :properties {:message-id "string" - :name {:type "string" :optional true} - :status "string" - :whisper-id "string" - :photo-path {:type "string" :optional true} - :tags {:type "list" - :objectType "tag"} - :created-at {:type "int" :default 0}}}) - -(defn migration [_ _] - (log/debug "migrating discover schema")) 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 new file mode 100644 index 0000000000..68df433a13 --- /dev/null +++ b/src/status_im/data_store/realm/schemas/account/v1/group_contact.cljs @@ -0,0 +1,5 @@ +(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/kv_store.cljs b/src/status_im/data_store/realm/schemas/account/v1/kv_store.cljs deleted file mode 100644 index 7b5fd9a5cc..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v1/kv_store.cljs +++ /dev/null @@ -1,10 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v1.kv-store - (:require [taoensso.timbre :as log])) - -(def schema {:name :kv-store - :primaryKey :key - :properties {:key "string" - :value "string"}}) - -(defn migration [_ _] - (log/debug "migrating kv-store schema")) diff --git a/src/status_im/data_store/realm/schemas/account/v8/local_storage.cljs b/src/status_im/data_store/realm/schemas/account/v1/local_storage.cljs similarity index 78% rename from src/status_im/data_store/realm/schemas/account/v8/local_storage.cljs rename to src/status_im/data_store/realm/schemas/account/v1/local_storage.cljs index 5b876108f4..a678e6d5a6 100644 --- a/src/status_im/data_store/realm/schemas/account/v8/local_storage.cljs +++ b/src/status_im/data_store/realm/schemas/account/v1/local_storage.cljs @@ -1,4 +1,4 @@ -(ns status-im.data-store.realm.schemas.account.v8.local-storage) +(ns status-im.data-store.realm.schemas.account.v1.local-storage) (def schema {:name :local-storage :primaryKey :chat-id 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 index 46851001c2..753b336cb5 100644 --- a/src/status_im/data_store/realm/schemas/account/v1/message.cljs +++ b/src/status_im/data_store/realm/schemas/account/v1/message.cljs @@ -1,36 +1,30 @@ -(ns status-im.data-store.realm.schemas.account.v1.message - (:require [taoensso.timbre :as log])) +(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} - :group-id {:type "string" - :optional true} - :content "string" ;; TODO make it ArrayBuffer - :content-type "string" - :timestamp "int" - :chat-id {:type "string" - :indexed true} - :outgoing "bool" - :retry-count {:type :int - :default 0} - :same-author "bool" - :same-direction "bool" - :preview {:type :string - :optional true} - :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}}}) - -(defn migration [_ _] - (log/debug "migrating message schema")) + :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} + :from-clock-value {:type :int + :default 0} + :to-clock-value {:type :int + :default 0} + :show? {:type :bool + :default true}}}) diff --git a/src/status_im/data_store/realm/schemas/account/v1/pending_message.cljs b/src/status_im/data_store/realm/schemas/account/v1/pending_message.cljs deleted file mode 100644 index bc5e7e87c5..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v1/pending_message.cljs +++ /dev/null @@ -1,22 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v1.pending-message - (:require [taoensso.timbre :as log])) - -(def schema {:name :pending-message - :primaryKey :id - :properties {:id :string - :message-id :string - :chat-id {:type :string - :optional true} - :ack? :bool - :requires-ack? :bool - :from :string - :to {:type :string - :optional true} - :payload :string - :type :string - :topics :string - :attempts :int - :was-sent? :bool}}) - -(defn migration [_ _] - (log/debug "migrating pending-message schema")) diff --git a/src/status_im/data_store/realm/schemas/account/v1/processed_message.cljs b/src/status_im/data_store/realm/schemas/account/v1/processed_message.cljs deleted file mode 100644 index 46a5209ec2..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v1/processed_message.cljs +++ /dev/null @@ -1,13 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v1.processed-message - (:require [taoensso.timbre :as log])) - -(def schema {:name :processed-message - :primaryKey :id - :properties {:id :string - :message-id :string - :type {:type "string" - :optional true} - :ttl :int}}) - -(defn migration [_ _] - (log/debug "migrating processed-message schema")) 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 index f2fa9bd054..8981ec3042 100644 --- a/src/status_im/data_store/realm/schemas/account/v1/request.cljs +++ b/src/status_im/data_store/realm/schemas/account/v1/request.cljs @@ -1,13 +1,8 @@ -(ns status-im.data-store.realm.schemas.account.v1.request - (:require [taoensso.timbre :as log])) +(ns status-im.data-store.realm.schemas.account.v1.request) (def schema {:name :request :properties {:message-id :string :chat-id :string - :type :string + :response :string :status {:type :string - :default "open"} - :added :date}}) - -(defn migration [_ _] - (log/debug "migrating request schema")) + :default "open"}}}) diff --git a/src/status_im/data_store/realm/schemas/account/v1/tag.cljs b/src/status_im/data_store/realm/schemas/account/v1/tag.cljs deleted file mode 100644 index 571263e3b7..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v1/tag.cljs +++ /dev/null @@ -1,10 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v1.tag - (:require [taoensso.timbre :as log])) - -(def schema {:name :tag - :primaryKey :name - :properties {:name "string" - :count {:type "int" :optional true :default 0}}}) - -(defn migration [_ _] - (log/debug "migrating tag schema")) diff --git a/src/status_im/data_store/realm/schemas/account/v22/transport.cljs b/src/status_im/data_store/realm/schemas/account/v1/transport.cljs similarity index 91% rename from src/status_im/data_store/realm/schemas/account/v22/transport.cljs rename to src/status_im/data_store/realm/schemas/account/v1/transport.cljs index 363c0222f8..8399164bd5 100644 --- a/src/status_im/data_store/realm/schemas/account/v22/transport.cljs +++ b/src/status_im/data_store/realm/schemas/account/v1/transport.cljs @@ -1,4 +1,4 @@ -(ns status-im.data-store.realm.schemas.account.v22.transport) +(ns status-im.data-store.realm.schemas.account.v1.transport) (def schema {:name :transport :primaryKey :chat-id 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 index 2b8fcb2d8f..b94a1ff0c9 100644 --- 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 @@ -1,12 +1,12 @@ -(ns status-im.data-store.realm.schemas.account.v1.user-status - (:require [taoensso.timbre :as log])) +(ns status-im.data-store.realm.schemas.account.v1.user-status) (def schema {:name :user-status - :primaryKey :id - :properties {:id "string" - :whisper-identity {:type "string" - :default ""} - :status "string"}}) - -(defn migration [_ _] - (log/debug "migrating user-status schema")) + :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 6478559686..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v10/core.cljs +++ /dev/null @@ -1,39 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v10.core - (:require [status-im.data-store.realm.schemas.account.v4.chat :as chat] - [status-im.data-store.realm.schemas.account.v1.chat-contact :as chat-contact] - [status-im.data-store.realm.schemas.account.v6.command :as command] - [status-im.data-store.realm.schemas.account.v9.command-parameter :as command-parameter] - [status-im.data-store.realm.schemas.account.v7.contact :as contact] - [status-im.data-store.realm.schemas.account.v1.discover :as discover] - [status-im.data-store.realm.schemas.account.v1.kv-store :as kv-store] - [status-im.data-store.realm.schemas.account.v10.message :as message] - [status-im.data-store.realm.schemas.account.v7.pending-message :as pending-message] - [status-im.data-store.realm.schemas.account.v1.processed-message :as processed-message] - [status-im.data-store.realm.schemas.account.v1.request :as request] - [status-im.data-store.realm.schemas.account.v1.tag :as tag] - [status-im.data-store.realm.schemas.account.v1.user-status :as user-status] - [status-im.data-store.realm.schemas.account.v5.contact-group :as contact-group] - [status-im.data-store.realm.schemas.account.v5.group-contact :as group-contact] - [status-im.data-store.realm.schemas.account.v8.local-storage :as local-storage] - [taoensso.timbre :as log])) - -(def schema [chat/schema - chat-contact/schema - command/schema - command-parameter/schema - contact/schema - discover/schema - kv-store/schema - message/schema - pending-message/schema - processed-message/schema - request/schema - tag/schema - user-status/schema - contact-group/schema - group-contact/schema - local-storage/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating v10 account database: " old-realm new-realm) - (message/migration old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/account/v10/message.cljs b/src/status_im/data_store/realm/schemas/account/v10/message.cljs deleted file mode 100644 index 025e423c5a..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v10/message.cljs +++ /dev/null @@ -1,52 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v10.message - (:require [taoensso.timbre :as log] - [goog.object :as object] - [clojure.string :as str])) - -(def schema {:name :message - :primaryKey :message-id - :properties {:message-id :string - :from :string - :to {:type :string - :optional true} - :group-id {: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} - :same-author :bool - :same-direction :bool - :preview {:type :string - :optional true} - :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}}}) - -(defn migration [old-realm new-realm] - (log/debug "migrating message schema v10") - (let [messages (.objects new-realm "message")] - (dotimes [i (.-length messages)] - (let [message (aget messages i) - content (object/get message "content") - type (object/get message "content-type")] - (when (and (or (= type "wallet-command") - (= type "wallet-request") - (= type "command") - (= type "command-request")) - (or (> (str/index-of content "command=send") -1) - (> (str/index-of content "command=request") -1))) - (aset message "show?" false)))))) diff --git a/src/status_im/data_store/realm/schemas/account/v11/chat.cljs b/src/status_im/data_store/realm/schemas/account/v11/chat.cljs deleted file mode 100644 index f1fd6378e2..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v11/chat.cljs +++ /dev/null @@ -1,50 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v11.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 :list - :objectType :chat-contact} - :unremovable? {:type :bool - :default false} - :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} - :last-message-id :string - :message-overhead {:type :int - :default 0} - :public-key {:type :string - :optional true} - :private-key {:type :string - :optional true} - :contact-info {:type :string - :optional true} - :debug? {:type :bool - :default false} - :public? {:type :bool - :default false}}}) - -(defn migration [old-realm new-realm] - (log/debug "migrating chat schema v11") - ;; make sure that console chat has `:unremovable?` set to true - (when-let [console-chat (-> new-realm - (.objects "chat") - (.filtered "chat-id = \"console\"") - (aget 0))] - (aset console-chat "unremovable?" true))) 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 1993197885..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v11/core.cljs +++ /dev/null @@ -1,39 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v11.core - (:require [status-im.data-store.realm.schemas.account.v11.chat :as chat] - [status-im.data-store.realm.schemas.account.v1.chat-contact :as chat-contact] - [status-im.data-store.realm.schemas.account.v6.command :as command] - [status-im.data-store.realm.schemas.account.v9.command-parameter :as command-parameter] - [status-im.data-store.realm.schemas.account.v7.contact :as contact] - [status-im.data-store.realm.schemas.account.v1.discover :as discover] - [status-im.data-store.realm.schemas.account.v1.kv-store :as kv-store] - [status-im.data-store.realm.schemas.account.v10.message :as message] - [status-im.data-store.realm.schemas.account.v7.pending-message :as pending-message] - [status-im.data-store.realm.schemas.account.v1.processed-message :as processed-message] - [status-im.data-store.realm.schemas.account.v1.request :as request] - [status-im.data-store.realm.schemas.account.v1.tag :as tag] - [status-im.data-store.realm.schemas.account.v1.user-status :as user-status] - [status-im.data-store.realm.schemas.account.v5.contact-group :as contact-group] - [status-im.data-store.realm.schemas.account.v5.group-contact :as group-contact] - [status-im.data-store.realm.schemas.account.v8.local-storage :as local-storage] - [taoensso.timbre :as log])) - -(def schema [chat/schema - chat-contact/schema - command/schema - command-parameter/schema - contact/schema - discover/schema - kv-store/schema - message/schema - pending-message/schema - processed-message/schema - request/schema - tag/schema - user-status/schema - contact-group/schema - group-contact/schema - local-storage/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating v11 account database: " old-realm new-realm) - (chat/migration old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/account/v12/core.cljs b/src/status_im/data_store/realm/schemas/account/v12/core.cljs deleted file mode 100644 index a5a05636c5..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v12/core.cljs +++ /dev/null @@ -1,39 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v12.core - (:require [status-im.data-store.realm.schemas.account.v11.chat :as chat] - [status-im.data-store.realm.schemas.account.v1.chat-contact :as chat-contact] - [status-im.data-store.realm.schemas.account.v6.command :as command] - [status-im.data-store.realm.schemas.account.v9.command-parameter :as command-parameter] - [status-im.data-store.realm.schemas.account.v7.contact :as contact] - [status-im.data-store.realm.schemas.account.v1.discover :as discover] - [status-im.data-store.realm.schemas.account.v1.kv-store :as kv-store] - [status-im.data-store.realm.schemas.account.v10.message :as message] - [status-im.data-store.realm.schemas.account.v12.pending-message :as pending-message] - [status-im.data-store.realm.schemas.account.v1.processed-message :as processed-message] - [status-im.data-store.realm.schemas.account.v1.request :as request] - [status-im.data-store.realm.schemas.account.v1.tag :as tag] - [status-im.data-store.realm.schemas.account.v1.user-status :as user-status] - [status-im.data-store.realm.schemas.account.v5.contact-group :as contact-group] - [status-im.data-store.realm.schemas.account.v5.group-contact :as group-contact] - [status-im.data-store.realm.schemas.account.v8.local-storage :as local-storage] - [taoensso.timbre :as log])) - -(def schema [chat/schema - chat-contact/schema - command/schema - command-parameter/schema - contact/schema - discover/schema - kv-store/schema - message/schema - pending-message/schema - processed-message/schema - request/schema - tag/schema - user-status/schema - contact-group/schema - group-contact/schema - local-storage/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating v12 account database: " old-realm new-realm) - (chat/migration old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/account/v12/pending_message.cljs b/src/status_im/data_store/realm/schemas/account/v12/pending_message.cljs deleted file mode 100644 index 6624600ad2..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v12/pending_message.cljs +++ /dev/null @@ -1,37 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v12.pending-message - (:require [goog.object :as object] - [taoensso.timbre :as log])) - -(def schema {:name :pending-message - :primaryKey :id - :properties {:id :string - :message-id :string - :chat-id {:type :string - :optional true} - :ack? :bool - :requires-ack? :bool - :sig :string - :pub-key {:type :string - :optional true} - :sym-key-id {:type :string - :optional true} - :to {:type :string - :optional true} - :payload :string - :type :string - :topic :string - :attempts :int - :was-sent? :bool}}) - -(defn migration [old-realm new-realm] - (log/debug "migrating pending-message schema v12") - (let [messages (.objects old-realm "pending-message") - new-messages (.objects new-realm "pending-message")] - (dotimes [i (.-length messages)] - (let [message (aget messages i) - new-message (aget new-messages i) - key-type (object/get message "key-type") - key (object/get message "key")] - (if (= key-type "sym") - (aset new-message "sym-key-id" key) - (aset new-message "pub-key" key)))))) diff --git a/src/status_im/data_store/realm/schemas/account/v13/core.cljs b/src/status_im/data_store/realm/schemas/account/v13/core.cljs deleted file mode 100644 index ae8bfe13ef..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v13/core.cljs +++ /dev/null @@ -1,40 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v13.core - (:require [status-im.data-store.realm.schemas.account.v11.chat :as chat] - [status-im.data-store.realm.schemas.account.v1.chat-contact :as chat-contact] - [status-im.data-store.realm.schemas.account.v6.command :as command] - [status-im.data-store.realm.schemas.account.v9.command-parameter :as command-parameter] - [status-im.data-store.realm.schemas.account.v7.contact :as contact] - [status-im.data-store.realm.schemas.account.v1.discover :as discover] - [status-im.data-store.realm.schemas.account.v1.kv-store :as kv-store] - [status-im.data-store.realm.schemas.account.v10.message :as message] - [status-im.data-store.realm.schemas.account.v12.pending-message :as pending-message] - [status-im.data-store.realm.schemas.account.v1.processed-message :as processed-message] - [status-im.data-store.realm.schemas.account.v1.request :as request] - [status-im.data-store.realm.schemas.account.v1.tag :as tag] - [status-im.data-store.realm.schemas.account.v1.user-status :as user-status] - [status-im.data-store.realm.schemas.account.v5.contact-group :as contact-group] - [status-im.data-store.realm.schemas.account.v5.group-contact :as group-contact] - [status-im.data-store.realm.schemas.account.v8.local-storage :as local-storage] - [status-im.data-store.realm.schemas.account.v13.handler-data :as handler-data] - [taoensso.timbre :as log])) - -(def schema [chat/schema - chat-contact/schema - command/schema - command-parameter/schema - contact/schema - discover/schema - kv-store/schema - message/schema - pending-message/schema - processed-message/schema - request/schema - tag/schema - user-status/schema - contact-group/schema - group-contact/schema - local-storage/schema - handler-data/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating v13 account database: " old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/account/v13/handler_data.cljs b/src/status_im/data_store/realm/schemas/account/v13/handler_data.cljs deleted file mode 100644 index 151a0e15df..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v13/handler_data.cljs +++ /dev/null @@ -1,8 +0,0 @@ - -(ns status-im.data-store.realm.schemas.account.v13.handler-data) - -(def schema {:name :handler-data - :primaryKey :message-id - :properties {:message-id "string" - :data {:type "string" - :default "{}"}}}) diff --git a/src/status_im/data_store/realm/schemas/account/v14/contact.cljs b/src/status_im/data_store/realm/schemas/account/v14/contact.cljs deleted file mode 100644 index ae097984b6..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v14/contact.cljs +++ /dev/null @@ -1,34 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v14.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} - :status {:type :string :optional true} - :fcm-token {:type :string :optional true} - :public-key {:type :string - :optional true} - :private-key {:type :string - :optional true} - :dapp? {:type :bool - :default false} - :dapp-url {:type :string - :optional true} - :bot-url {:type :string - :optional true} - :global-command {:type :command - :optional true} - :commands {:type :list - :objectType :command} - :responses {:type :list - :objectType :command} - :dapp-hash {:type :int - :optional true} - :debug? {:type :bool - :default false}}}) diff --git a/src/status_im/data_store/realm/schemas/account/v14/core.cljs b/src/status_im/data_store/realm/schemas/account/v14/core.cljs deleted file mode 100644 index d6509d279f..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v14/core.cljs +++ /dev/null @@ -1,40 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v14.core - (:require [status-im.data-store.realm.schemas.account.v11.chat :as chat] - [status-im.data-store.realm.schemas.account.v1.chat-contact :as chat-contact] - [status-im.data-store.realm.schemas.account.v6.command :as command] - [status-im.data-store.realm.schemas.account.v9.command-parameter :as command-parameter] - [status-im.data-store.realm.schemas.account.v14.contact :as contact] - [status-im.data-store.realm.schemas.account.v1.discover :as discover] - [status-im.data-store.realm.schemas.account.v1.kv-store :as kv-store] - [status-im.data-store.realm.schemas.account.v10.message :as message] - [status-im.data-store.realm.schemas.account.v12.pending-message :as pending-message] - [status-im.data-store.realm.schemas.account.v1.processed-message :as processed-message] - [status-im.data-store.realm.schemas.account.v1.request :as request] - [status-im.data-store.realm.schemas.account.v1.tag :as tag] - [status-im.data-store.realm.schemas.account.v1.user-status :as user-status] - [status-im.data-store.realm.schemas.account.v5.contact-group :as contact-group] - [status-im.data-store.realm.schemas.account.v5.group-contact :as group-contact] - [status-im.data-store.realm.schemas.account.v8.local-storage :as local-storage] - [status-im.data-store.realm.schemas.account.v13.handler-data :as handler-data] - [taoensso.timbre :as log])) - -(def schema [chat/schema - chat-contact/schema - command/schema - command-parameter/schema - contact/schema - discover/schema - kv-store/schema - message/schema - pending-message/schema - processed-message/schema - request/schema - tag/schema - user-status/schema - contact-group/schema - group-contact/schema - local-storage/schema - handler-data/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating v14 account database: " old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/account/v15/contact.cljs b/src/status_im/data_store/realm/schemas/account/v15/contact.cljs deleted file mode 100644 index e3273457a8..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v15/contact.cljs +++ /dev/null @@ -1,47 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v15.contact - (:require [goog.object :as object] - [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} - :mixable? {:type :bool :default false} - :status {:type :string :optional true} - :fcm-token {:type :string :optional true} - :public-key {:type :string - :optional true} - :private-key {:type :string - :optional true} - :dapp? {:type :bool - :default false} - :dapp-url {:type :string - :optional true} - :bot-url {:type :string - :optional true} - :global-command {:type :command - :optional true} - :commands {:type :list - :objectType :command} - :responses {:type :list - :objectType :command} - :dapp-hash {:type :int - :optional true} - :debug? {:type :bool - :default false}}}) - -(defn migration [old-realm new-realm] - (log/debug "migrating contact schema v15") - (let [new-contacts (.objects new-realm "contact")] - (dotimes [i (.-length new-contacts)] - (let [contact (aget new-contacts i) - id (object/get contact "whisper-identity")] - (when (or (= id "mailman") - (= id "transactor-group") - (= id "transactor-personal")) - (aset contact "mixable?" true)))))) diff --git a/src/status_im/data_store/realm/schemas/account/v15/core.cljs b/src/status_im/data_store/realm/schemas/account/v15/core.cljs deleted file mode 100644 index 43f6b1fd2e..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v15/core.cljs +++ /dev/null @@ -1,41 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v15.core - (:require [status-im.data-store.realm.schemas.account.v11.chat :as chat] - [status-im.data-store.realm.schemas.account.v1.chat-contact :as chat-contact] - [status-im.data-store.realm.schemas.account.v6.command :as command] - [status-im.data-store.realm.schemas.account.v9.command-parameter :as command-parameter] - [status-im.data-store.realm.schemas.account.v15.contact :as contact] - [status-im.data-store.realm.schemas.account.v1.discover :as discover] - [status-im.data-store.realm.schemas.account.v1.kv-store :as kv-store] - [status-im.data-store.realm.schemas.account.v10.message :as message] - [status-im.data-store.realm.schemas.account.v12.pending-message :as pending-message] - [status-im.data-store.realm.schemas.account.v1.processed-message :as processed-message] - [status-im.data-store.realm.schemas.account.v15.request :as request] - [status-im.data-store.realm.schemas.account.v1.tag :as tag] - [status-im.data-store.realm.schemas.account.v1.user-status :as user-status] - [status-im.data-store.realm.schemas.account.v5.contact-group :as contact-group] - [status-im.data-store.realm.schemas.account.v5.group-contact :as group-contact] - [status-im.data-store.realm.schemas.account.v8.local-storage :as local-storage] - [status-im.data-store.realm.schemas.account.v13.handler-data :as handler-data] - [taoensso.timbre :as log])) - -(def schema [chat/schema - chat-contact/schema - command/schema - command-parameter/schema - contact/schema - discover/schema - kv-store/schema - message/schema - pending-message/schema - processed-message/schema - request/schema - tag/schema - user-status/schema - contact-group/schema - group-contact/schema - local-storage/schema - handler-data/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating v15 account database: " old-realm new-realm) - (contact/migration old-realm new-realm)) \ No newline at end of file diff --git a/src/status_im/data_store/realm/schemas/account/v15/request.cljs b/src/status_im/data_store/realm/schemas/account/v15/request.cljs deleted file mode 100644 index cf7170beb8..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v15/request.cljs +++ /dev/null @@ -1,15 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v15.request - (:require [taoensso.timbre :as log])) - -(def schema {:name :request - :properties {:message-id :string - :chat-id :string - :bot {:type :string - :optional true} - :type :string - :status {:type :string - :default "open"} - :added :date}}) - -(defn migration [_ _] - (log/debug "migrating request schema")) diff --git a/src/status_im/data_store/realm/schemas/account/v16/contact.cljs b/src/status_im/data_store/realm/schemas/account/v16/contact.cljs deleted file mode 100644 index 3bcb185751..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v16/contact.cljs +++ /dev/null @@ -1,33 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v16.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} - :mixable? {: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} - :private-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}}}) - -(defn migration [old-realm new-realm] - (log/debug "migrating contact schema v16")) diff --git a/src/status_im/data_store/realm/schemas/account/v16/core.cljs b/src/status_im/data_store/realm/schemas/account/v16/core.cljs deleted file mode 100644 index c45f5ae7d6..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v16/core.cljs +++ /dev/null @@ -1,74 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v16.core - (:require [status-im.data-store.realm.schemas.account.v11.chat :as chat] - [status-im.data-store.realm.schemas.account.v1.chat-contact :as chat-contact] - [status-im.data-store.realm.schemas.account.v6.command :as command] - [status-im.data-store.realm.schemas.account.v9.command-parameter :as command-parameter] - [status-im.data-store.realm.schemas.account.v16.contact :as contact] - [status-im.data-store.realm.schemas.account.v1.discover :as discover] - [status-im.data-store.realm.schemas.account.v1.kv-store :as kv-store] - [status-im.data-store.realm.schemas.account.v10.message :as message] - [status-im.data-store.realm.schemas.account.v12.pending-message :as pending-message] - [status-im.data-store.realm.schemas.account.v1.processed-message :as processed-message] - [status-im.data-store.realm.schemas.account.v15.request :as request] - [status-im.data-store.realm.schemas.account.v1.tag :as tag] - [status-im.data-store.realm.schemas.account.v1.user-status :as user-status] - [status-im.data-store.realm.schemas.account.v5.contact-group :as contact-group] - [status-im.data-store.realm.schemas.account.v5.group-contact :as group-contact] - [status-im.data-store.realm.schemas.account.v8.local-storage :as local-storage] - [status-im.data-store.realm.schemas.account.v13.handler-data :as handler-data] - [goog.object :as object] - [taoensso.timbre :as log] - [cljs.reader :as reader])) - -(def schema [chat/schema - chat-contact/schema - command/schema - command-parameter/schema - contact/schema - discover/schema - kv-store/schema - message/schema - pending-message/schema - processed-message/schema - request/schema - tag/schema - user-status/schema - contact-group/schema - group-contact/schema - local-storage/schema - handler-data/schema]) - -(defn chat-by-id [realm chat-id] - (some-> realm - (.objects "chat") - (.filtered (str "chat-id = \"" chat-id "\"")) - (aget 0))) - -(defn migrate-commands [realm content-type] - (some-> realm - (.objects "message") - (.filtered (str "content-type = \"" content-type "\"")) - (.map (fn [object _ _] - (let [group-id (object/get object "group-id") - {:keys [bot] :as content} (reader/read-string (object/get object "content"))] - (when-not bot - (let [chat-id (object/get object "chat-id") - chat (chat-by-id realm chat-id) - group? (object/get chat "group-chat") - bot-name (if group? - "transactor-group" - "transactor-personal") - content' (assoc content :bot bot-name)] - (aset object "content" (pr-str content'))))))))) - -(defn migration [old-realm new-realm] - (log/debug "migrating v16 account database: " old-realm new-realm) - (when-let [wallet-chat (chat-by-id new-realm "wallet")] - (.delete new-realm wallet-chat)) - (when-let [wallet-contact (some-> new-realm - (.objects "contact") - (.filtered (str "whisper-identity = \"wallet\"")) - (aget 0))] - (.delete new-realm wallet-contact)) - (migrate-commands new-realm "command-request") - (migrate-commands new-realm "command")) diff --git a/src/status_im/data_store/realm/schemas/account/v17/core.cljs b/src/status_im/data_store/realm/schemas/account/v17/core.cljs deleted file mode 100644 index bcf7c534ea..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v17/core.cljs +++ /dev/null @@ -1,92 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v17.core - (:require [status-im.data-store.realm.schemas.account.v11.chat :as chat] - [status-im.data-store.realm.schemas.account.v1.chat-contact :as chat-contact] - [status-im.data-store.realm.schemas.account.v6.command :as command] - [status-im.data-store.realm.schemas.account.v9.command-parameter :as command-parameter] - [status-im.data-store.realm.schemas.account.v16.contact :as contact] - [status-im.data-store.realm.schemas.account.v1.discover :as discover] - [status-im.data-store.realm.schemas.account.v1.kv-store :as kv-store] - [status-im.data-store.realm.schemas.account.v10.message :as message] - [status-im.data-store.realm.schemas.account.v12.pending-message :as pending-message] - [status-im.data-store.realm.schemas.account.v1.processed-message :as processed-message] - [status-im.data-store.realm.schemas.account.v15.request :as request] - [status-im.data-store.realm.schemas.account.v1.tag :as tag] - [status-im.data-store.realm.schemas.account.v1.user-status :as user-status] - [status-im.data-store.realm.schemas.account.v5.contact-group :as contact-group] - [status-im.data-store.realm.schemas.account.v5.group-contact :as group-contact] - [status-im.data-store.realm.schemas.account.v8.local-storage :as local-storage] - [status-im.data-store.realm.schemas.account.v13.handler-data :as handler-data] - [goog.object :as object] - [taoensso.timbre :as log] - [cljs.reader :as reader])) - -(def schema [chat/schema - chat-contact/schema - command/schema - command-parameter/schema - contact/schema - discover/schema - kv-store/schema - message/schema - pending-message/schema - processed-message/schema - request/schema - tag/schema - user-status/schema - contact-group/schema - group-contact/schema - local-storage/schema - handler-data/schema]) - - -(defn remove-chat-with-contact! [new-realm whisper-identity] - (when-let [chat-contact (some-> new-realm - (.objects "chat-contact") - (.filtered (str "identity = \"" whisper-identity "\"")) - (aget 0))] - (log/debug "v17 Removing chat-contact with contact" (pr-str chat-contact)) - (.delete new-realm chat-contact)) - (when-let [chat (some-> new-realm - (.objects "chat") - (.filtered (str "chat-id = \"" whisper-identity "\"")) - (aget 0))] - (log/debug "v17 Removing chat with contact" (pr-str chat)) - (.delete new-realm chat))) - -(defn remove-contact! [new-realm whisper-identity] - (when-let [contact (some-> new-realm - (.objects "contact") - (.filtered (str "whisper-identity = \"" whisper-identity "\"")) - (aget 0))] - (log/debug "v17 Removing contact" (pr-str contact)) - (.delete new-realm contact))) - -(defn command-with-wrong-bot? [bot command] - (and - (#{"transactor-personal" "transactor-group"} bot) - (not (#{"send" "request"} command)))) - -(defn update-commands [new-realm content-type] - (some-> new-realm - (.objects "message") - (.filtered (str "content-type = \"" content-type "\"")) - (.map (fn [object _ _] - (let [{:keys [bot command] :as content} (reader/read-string (object/get object "content")) - content' (cond-> - content - - (= "password" command) - (update :params dissoc :password :password-confirmation) - - (command-with-wrong-bot? bot command) - (assoc :bot nil))] - (aset object "content" (pr-str content'))))))) - -;; NOTE(oskarth): Resets Realm for some dApps to be loaded by default_contacts.json instead. -(defn migration [old-realm new-realm] - (log/debug "migrating v17 account database: " old-realm new-realm) - (doseq [contact-id ["oaken-water-meter" "gnosis" "Commiteth" "melonport" "Etherplay"]] - (remove-chat-with-contact! new-realm contact-id) - (remove-contact! new-realm contact-id)) - (update-commands new-realm "command") - (update-commands new-realm "command-request")) diff --git a/src/status_im/data_store/realm/schemas/account/v18/core.cljs b/src/status_im/data_store/realm/schemas/account/v18/core.cljs deleted file mode 100644 index f7e2374b8b..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v18/core.cljs +++ /dev/null @@ -1,41 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v18.core - (:require [status-im.data-store.realm.schemas.account.v11.chat :as chat] - [status-im.data-store.realm.schemas.account.v1.chat-contact :as chat-contact] - [status-im.data-store.realm.schemas.account.v6.command :as command] - [status-im.data-store.realm.schemas.account.v9.command-parameter :as command-parameter] - [status-im.data-store.realm.schemas.account.v16.contact :as contact] - [status-im.data-store.realm.schemas.account.v1.discover :as discover] - [status-im.data-store.realm.schemas.account.v1.kv-store :as kv-store] - [status-im.data-store.realm.schemas.account.v10.message :as message] - [status-im.data-store.realm.schemas.account.v18.pending-message :as pending-message] - [status-im.data-store.realm.schemas.account.v1.processed-message :as processed-message] - [status-im.data-store.realm.schemas.account.v15.request :as request] - [status-im.data-store.realm.schemas.account.v1.tag :as tag] - [status-im.data-store.realm.schemas.account.v1.user-status :as user-status] - [status-im.data-store.realm.schemas.account.v5.contact-group :as contact-group] - [status-im.data-store.realm.schemas.account.v5.group-contact :as group-contact] - [status-im.data-store.realm.schemas.account.v8.local-storage :as local-storage] - [status-im.data-store.realm.schemas.account.v13.handler-data :as handler-data] - [taoensso.timbre :as log] - [cljs.reader :as reader])) - -(def schema [chat/schema - chat-contact/schema - command/schema - command-parameter/schema - contact/schema - discover/schema - kv-store/schema - message/schema - pending-message/schema - processed-message/schema - request/schema - tag/schema - user-status/schema - contact-group/schema - group-contact/schema - local-storage/schema - handler-data/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating v18 account database: " old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/account/v18/pending_message.cljs b/src/status_im/data_store/realm/schemas/account/v18/pending_message.cljs deleted file mode 100644 index 193f632835..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v18/pending_message.cljs +++ /dev/null @@ -1,26 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v18.pending-message - (:require [taoensso.timbre :as log])) - -(def schema {:name :pending-message - :primaryKey :id - :properties {:id :string - :message-id :string - :chat-id {:type :string - :optional true} - :ack? :bool - :requires-ack? :bool - :sig :string - :pub-key {:type :string - :optional true} - :sym-key-password {:type :string - :optional true} - :to {:type :string - :optional true} - :payload :string - :type :string - :topic :string - :attempts :int - :was-sent? :bool}}) - -(defn migration [old-realm new-realm] - (log/debug "migrating pending-message schema v18")) diff --git a/src/status_im/data_store/realm/schemas/account/v19/chat.cljs b/src/status_im/data_store/realm/schemas/account/v19/chat.cljs deleted file mode 100644 index b888245a14..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v19/chat.cljs +++ /dev/null @@ -1,39 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v19.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 :list - :objectType :chat-contact} - :unremovable? {:type :bool - :default false} - :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} - :public-key {:type :string - :optional true} - :private-key {:type :string - :optional true} - :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/v19/contact.cljs b/src/status_im/data_store/realm/schemas/account/v19/contact.cljs deleted file mode 100644 index 4c240afc5e..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v19/contact.cljs +++ /dev/null @@ -1,30 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v19.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} - :private-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/v19/core.cljs b/src/status_im/data_store/realm/schemas/account/v19/core.cljs deleted file mode 100644 index 52fb18e5a2..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v19/core.cljs +++ /dev/null @@ -1,157 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v19.core - (:require [status-im.data-store.realm.schemas.account.v19.chat :as chat] - [status-im.data-store.realm.schemas.account.v1.chat-contact :as chat-contact] - [status-im.data-store.realm.schemas.account.v19.contact :as contact] - [status-im.data-store.realm.schemas.account.v1.discover :as discover] - [status-im.data-store.realm.schemas.account.v19.message :as message] - [status-im.data-store.realm.schemas.account.v12.pending-message :as pending-message] - [status-im.data-store.realm.schemas.account.v1.processed-message :as processed-message] - [status-im.data-store.realm.schemas.account.v19.request :as request] - [status-im.data-store.realm.schemas.account.v1.tag :as tag] - [status-im.data-store.realm.schemas.account.v19.user-status :as user-status] - [status-im.data-store.realm.schemas.account.v5.contact-group :as contact-group] - [status-im.data-store.realm.schemas.account.v5.group-contact :as group-contact] - [status-im.data-store.realm.schemas.account.v8.local-storage :as local-storage] - [goog.object :as object] - [taoensso.timbre :as log] - [cljs.reader :as reader])) - -(def schema [chat/schema - chat-contact/schema - contact/schema - discover/schema - message/schema - pending-message/schema - processed-message/schema - request/schema - tag/schema - user-status/schema - contact-group/schema - group-contact/schema - local-storage/schema]) - -(defn remove-console-intro-message! [new-realm] - (when-let [console-intro-message (some-> new-realm - (.objects "message") - (.filtered (str "message-id = \"intro-status\"")) - (aget 0))] - (log/debug "v19 Removing console intro message " (pr-str console-intro-message)) - (.delete new-realm console-intro-message))) - -(defn remove-contact! [new-realm whisper-identity] - (when-let [contact (some-> new-realm - (.objects "contact") - (.filtered (str "whisper-identity = \"" whisper-identity "\"")) - (aget 0))] - (log/debug "v19 Removing contact " (pr-str contact)) - (.delete new-realm contact))) - -(def owner-command->new-props - {;; console commands - ["console" "password"] {:content-command-ref ["console" :response 42 "password"] - :content-command-scope-bitmask 42} - ["console" "debug"] {:content-command-ref ["console" :command 50 "debug"] - :content-command-scope-bitmask 50} - ["console" "phone"] {:content-command-ref ["console" :response 50 "phone"] - :content-command-scope-bitmask 50} - ["console" "confirmation-code"] {:content-command-ref ["console" :response 50 "confirmation-code"] - :content-command-scope-bitmask 50} - ["console" "faucet"] {:content-command-ref ["console" :command 50 "faucet"] - :content-command-scope-bitmask 50} - ;; mailman commands - ["mailman" "location"] {:content-command-ref ["mailman" :command 215 "location"] - :content-command-scope-bitmask 215} - ;; transactor personal - ["transactor-personal" "send"] {:content-command-ref ["transactor" :command 83 "send"] - :content-command-scope-bitmask 83 - :bot "transactor"} - ["transactor-personal" "request"] {:content-command-ref ["transactor" :command 83 "request"] - :content-command-scope-bitmask 83 - :bot "transactor"} - ;; transactor group - ["transactor-group" "send"] {:content-command-ref ["transactor" :command 85 "send"] - :content-command-scope-bitmask 85 - :bot "transactor"} - ["transactor-group" "request"] {:content-command-ref ["transactor" :command 85 "request"] - :content-command-scope-bitmask 85 - :bot "transactor"}}) - -(def console-requests->new-props - {;; console - ["password"] {:content-command-ref ["console" :response 42 "password"]} - ["phone"] {:content-command-ref ["console" :response 50 "phone"]} - ["confirmation-code"] {:content-command-ref ["console" :response 50 "confirmation-code"]}}) - -(def transactor-requests->new-props - {;; former transactor-personal request - ["send" 1] {:content-command-ref ["transactor" :response 83 "send"] - :content-command-scope-bitmask 83 - :bot "transactor"} - ;; former transactor-group request - ["send" 2] {:content-command-ref ["transactor" :response 85 "send"] - :content-command-scope-bitmask 85 - :bot "transactor"}}) - -(defn update-commands [selector mapping new-realm content-type] - (some-> new-realm - (.objects "message") - (.filtered (str "content-type = \"" content-type "\"")) - (.map (fn [object _ _] - (let [content (reader/read-string (object/get object "content")) - new-props (get mapping (selector content)) - new-content (merge content new-props)] - (log/debug "migrating v19 command/request database, updating: " content " with: " new-props) - (aset object "content" (pr-str new-content))))))) - -(defn update-message-statuses [new-realm] - (let [status-ids (atom #{})] - (some-> new-realm - (.objects "message") - (.map (fn [msg _ _] - (let [message-id (object/get msg "message-id") - chat-id (object/get msg "chat-id") - from (object/get msg "from") - msg-status (object/get msg "message-status") - statuses (object/get msg "user-statuses")] - (when statuses - (.map statuses (fn [status _ _] - (let [status-id (str message-id "-" from)] - (if (@status-ids status-id) - (.delete new-realm status) - (do - (swap! status-ids conj status-id) - (aset status "status-id" status-id) - (aset status "message-id" message-id) - (aset status "chat-id" chat-id)))))) - (let [sender (or from "anonymous") - sender-status (str message-id "-" sender) - new-status (or msg-status (if (= "console" chat-id) - "seen" - "received"))] - (when-not (@status-ids sender-status) - (.push statuses (clj->js {"status-id" sender-status - "message-id" message-id - "chat-id" chat-id - "status" new-status - "whisper-identity" sender}))))))))))) - -(defn delete-orphaned-statuses [new-realm] - (let [id-seq (atom 0)] - (some-> new-realm - (.objects "user-status") - (.map (fn [status _ _] - ;; orphaned statues, status-id must be set to some unique value, as realm complains when they are deleted - (when (clojure.string/blank? (object/get status "status-id")) - (log/debug "Setting unique id for orphaned status") - (aset status "status-id" (str (swap! id-seq inc) "-deleted")))))))) - -(defn migration [old-realm new-realm] - (log/debug "migrating v19 account database: " old-realm new-realm) - (remove-contact! new-realm "transactor-personal") - (remove-contact! new-realm "transactor-group") - (remove-console-intro-message! new-realm) - (update-commands (juxt :bot :command) owner-command->new-props new-realm "command") - (update-commands (juxt :command) console-requests->new-props new-realm "command-request") - (update-commands (juxt :command (comp count :prefill)) transactor-requests->new-props new-realm "command-request") - (update-message-statuses new-realm) - (delete-orphaned-statuses new-realm)) diff --git a/src/status_im/data_store/realm/schemas/account/v19/message.cljs b/src/status_im/data_store/realm/schemas/account/v19/message.cljs deleted file mode 100644 index a03d46a75c..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v19/message.cljs +++ /dev/null @@ -1,30 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v19.message) - -(def schema {:name :message - :primaryKey :message-id - :properties {:message-id :string - :from :string - :to {:type :string - :optional true} - :group-id {: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/v19/request.cljs b/src/status_im/data_store/realm/schemas/account/v19/request.cljs deleted file mode 100644 index 32990b53af..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v19/request.cljs +++ /dev/null @@ -1,8 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v19.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/v19/user_status.cljs b/src/status_im/data_store/realm/schemas/account/v19/user_status.cljs deleted file mode 100644 index e0ba8fef4d..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v19/user_status.cljs +++ /dev/null @@ -1,12 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v19.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/v2/chat.cljs b/src/status_im/data_store/realm/schemas/account/v2/chat.cljs deleted file mode 100644 index 67e0cd2fc8..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v2/chat.cljs +++ /dev/null @@ -1,38 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v2.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 :list - :objectType :chat-contact} - :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} - :last-message-id :string - :message-overhead {:type :int - :default 0} - :public-key {:type :string - :optional true} - :private-key {:type :string - :optional true} - :contact-info {:type :string - :optional true}}}) - -(defn migration [old-realm new-realm] - (log/debug "migrating chat schema v2")) diff --git a/src/status_im/data_store/realm/schemas/account/v2/contact.cljs b/src/status_im/data_store/realm/schemas/account/v2/contact.cljs deleted file mode 100644 index e7868b1c2f..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v2/contact.cljs +++ /dev/null @@ -1,26 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v2.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} - :status {:type "string" :optional true} - :public-key {:type :string - :optional true} - :private-key {:type :string - :optional true} - :dapp? {:type :bool - :default false} - :dapp-url {:type :string - :optional true} - :dapp-hash {:type :int - :optional true}}}) - -(defn migration [old-realm new-realm] - (log/debug "migrating contact schema v2")) 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 aaa93940b8..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v2/core.cljs +++ /dev/null @@ -1,32 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v2.core - (:require [status-im.data-store.realm.schemas.account.v2.chat :as chat] - [status-im.data-store.realm.schemas.account.v1.chat-contact :as chat-contact] - [status-im.data-store.realm.schemas.account.v1.command :as command] - [status-im.data-store.realm.schemas.account.v2.contact :as contact] - [status-im.data-store.realm.schemas.account.v1.discover :as discover] - [status-im.data-store.realm.schemas.account.v1.kv-store :as kv-store] - [status-im.data-store.realm.schemas.account.v1.message :as message] - [status-im.data-store.realm.schemas.account.v1.pending-message :as pending-message] - [status-im.data-store.realm.schemas.account.v1.processed-message :as processed-message] - [status-im.data-store.realm.schemas.account.v1.request :as request] - [status-im.data-store.realm.schemas.account.v1.tag :as tag] - [status-im.data-store.realm.schemas.account.v1.user-status :as user-status] - [taoensso.timbre :as log])) - -(def schema [chat/schema - chat-contact/schema - command/schema - contact/schema - discover/schema - kv-store/schema - message/schema - pending-message/schema - processed-message/schema - request/schema - tag/schema - user-status/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating v2 account database: " old-realm new-realm) - (chat/migration old-realm new-realm) - (contact/migration old-realm new-realm)) \ No newline at end of file diff --git a/src/status_im/data_store/realm/schemas/account/v20/core.cljs b/src/status_im/data_store/realm/schemas/account/v20/core.cljs deleted file mode 100644 index 2cfe658aad..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v20/core.cljs +++ /dev/null @@ -1,31 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v20.core - (:require [status-im.data-store.realm.schemas.account.v19.chat :as chat] - [status-im.data-store.realm.schemas.account.v1.chat-contact :as chat-contact] - [status-im.data-store.realm.schemas.account.v19.contact :as contact] - [status-im.data-store.realm.schemas.account.v20.discover :as discover] - [status-im.data-store.realm.schemas.account.v19.message :as message] - [status-im.data-store.realm.schemas.account.v12.pending-message :as pending-message] - [status-im.data-store.realm.schemas.account.v1.processed-message :as processed-message] - [status-im.data-store.realm.schemas.account.v19.request :as request] - [status-im.data-store.realm.schemas.account.v19.user-status :as user-status] - [status-im.data-store.realm.schemas.account.v5.contact-group :as contact-group] - [status-im.data-store.realm.schemas.account.v5.group-contact :as group-contact] - [status-im.data-store.realm.schemas.account.v8.local-storage :as local-storage] - [taoensso.timbre :as log] - [cljs.reader :as reader])) - -(def schema [chat/schema - chat-contact/schema - contact/schema - discover/schema - message/schema - pending-message/schema - processed-message/schema - request/schema - user-status/schema - contact-group/schema - group-contact/schema - local-storage/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating v20 account database: " old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/account/v20/discover.cljs b/src/status_im/data_store/realm/schemas/account/v20/discover.cljs deleted file mode 100644 index 6cac634f13..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v20/discover.cljs +++ /dev/null @@ -1,14 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v20.discover - (:require [taoensso.timbre :as log])) - -(def schema {:name :discover - :primaryKey :message-id - :properties {:message-id "string" - :name {:type "string" :optional true} - :status "string" - :whisper-id "string" - :photo-path {:type "string" :optional true} - :created-at {:type "int" :default 0}}}) - -(defn migration [_ _] - (log/debug "migrating discover schema")) diff --git a/src/status_im/data_store/realm/schemas/account/v21/chat.cljs b/src/status_im/data_store/realm/schemas/account/v21/chat.cljs deleted file mode 100644 index 51e2ad1c1e..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v21/chat.cljs +++ /dev/null @@ -1,37 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v21.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 :list - :objectType :chat-contact} - :unremovable? {:type :bool - :default false} - :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} - :public-key {:type :string - :optional true} - :private-key {:type :string - :optional true} - :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/v21/core.cljs b/src/status_im/data_store/realm/schemas/account/v21/core.cljs deleted file mode 100644 index 8a8b24117d..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v21/core.cljs +++ /dev/null @@ -1,97 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v21.core - (:require [status-im.data-store.realm.schemas.account.v19.chat :as chat] - [status-im.data-store.realm.schemas.account.v1.chat-contact :as chat-contact] - [status-im.data-store.realm.schemas.account.v19.contact :as contact] - [status-im.data-store.realm.schemas.account.v20.discover :as discover] - [status-im.data-store.realm.schemas.account.v19.message :as message] - [status-im.data-store.realm.schemas.account.v12.pending-message :as pending-message] - [status-im.data-store.realm.schemas.account.v1.processed-message :as processed-message] - [status-im.data-store.realm.schemas.account.v19.request :as request] - [status-im.data-store.realm.schemas.account.v19.user-status :as user-status] - [status-im.data-store.realm.schemas.account.v5.contact-group :as contact-group] - [status-im.data-store.realm.schemas.account.v5.group-contact :as group-contact] - [status-im.data-store.realm.schemas.account.v8.local-storage :as local-storage] - [status-im.data-store.realm.schemas.account.v21.browser :as browser] - [taoensso.timbre :as log] - [cljs.reader :as reader] - [clojure.string :as string])) - -(def schema [chat/schema - chat-contact/schema - contact/schema - discover/schema - message/schema - pending-message/schema - processed-message/schema - request/schema - user-status/schema - contact-group/schema - group-contact/schema - local-storage/schema - browser/schema]) - -(defn remove-contact! [new-realm whisper-identity] - (when-let [contact (some-> new-realm - (.objects "contact") - (.filtered (str "whisper-identity = \"" whisper-identity "\"")) - (aget 0))] - (log/debug "v21 Removing contact " (pr-str contact)) - (.delete new-realm contact))) - -(defn remove-location-messages! [old-realm new-realm] - (let [messages (.objects new-realm "message")] - (dotimes [i (.-length messages)] - (let [message (aget messages i) - content (aget message "content") - type (aget message "content-type")] - (when (and (= type "command") - (string/includes? content "command=location")) - (aset message "show?" false)))))) - -(defn remove-phone-messages! [old-realm new-realm] - (let [messages (.objects new-realm "message")] - (dotimes [i (.-length messages)] - (let [message (aget messages i) - content (aget message "content") - type (aget message "content-type")] - (when (and (= type "command") - (string/includes? content "command=phone")) - (aset message "show?" false)))))) - -(defn chat-by-id [chats chat-id] - (some-> chats - (.filtered (str "chat-id = \"" chat-id "\"")) - (aget 0))) - -(defn contact-by-id [contacts contact-id] - (some-> contacts - (.filtered (str "whisper-identity = \"" contact-id "\"")) - (aget 0))) - -(defn messages-by-chat-id [messages chat-id] - (some-> messages - (.filtered (str "chat-id = \"" chat-id "\"")))) - -(defn remove-dapp! [realm dapp] - (let [contacts (.objects realm "contact") - chats (.objects realm "chat") - messages (.objects realm "message")] - (when-let [contact (contact-by-id contacts dapp)] - (.delete realm contact) - (when-let [chat (chat-by-id chats dapp)] - (.delete realm chat) - (when-let [messages (messages-by-chat-id messages dapp)] - (.delete realm messages)))))) - -(defn clean-dapps! [realm] - (let [dapps #{"bchat" "Dentacoin" "gnosis" "melonport" "oaken-water-meter" - "Ethcro" "Augur" "mkr-market"}] - (doseq [dapp dapps] - (remove-dapp! realm dapp)))) - -(defn migration [old-realm new-realm] - (log/debug "migrating v21 account database: " old-realm new-realm) - (remove-contact! new-realm "browse") - (remove-location-messages! old-realm new-realm) - (remove-phone-messages! old-realm new-realm) - (clean-dapps! new-realm)) diff --git a/src/status_im/data_store/realm/schemas/account/v22/chat.cljs b/src/status_im/data_store/realm/schemas/account/v22/chat.cljs deleted file mode 100644 index dd643807cf..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v22/chat.cljs +++ /dev/null @@ -1,37 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v22.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 :list - :objectType :chat-contact} - :unremovable? {:type :bool - :default false} - :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} - :public-key {:type :string - :optional true} - :private-key {:type :string - :optional true} - :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/v22/core.cljs b/src/status_im/data_store/realm/schemas/account/v22/core.cljs deleted file mode 100644 index 25d05bdaac..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v22/core.cljs +++ /dev/null @@ -1,36 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v22.core - (:require [status-im.data-store.realm.schemas.account.v22.chat :as chat] - [status-im.data-store.realm.schemas.account.v22.transport :as transport] - [status-im.data-store.realm.schemas.account.v1.chat-contact :as chat-contact] - [status-im.data-store.realm.schemas.account.v19.contact :as contact] - [status-im.data-store.realm.schemas.account.v20.discover :as discover] - [status-im.data-store.realm.schemas.account.v19.message :as message] - [status-im.data-store.realm.schemas.account.v12.pending-message :as pending-message] - [status-im.data-store.realm.schemas.account.v1.processed-message :as processed-message] - [status-im.data-store.realm.schemas.account.v19.request :as request] - [status-im.data-store.realm.schemas.account.v19.user-status :as user-status] - [status-im.data-store.realm.schemas.account.v5.contact-group :as contact-group] - [status-im.data-store.realm.schemas.account.v5.group-contact :as group-contact] - [status-im.data-store.realm.schemas.account.v8.local-storage :as local-storage] - [status-im.data-store.realm.schemas.account.v21.browser :as browser] - [taoensso.timbre :as log] - [cljs.reader :as reader] - [clojure.string :as string])) - -(def schema [chat/schema - chat-contact/schema - transport/schema - contact/schema - discover/schema - message/schema - pending-message/schema - processed-message/schema - request/schema - user-status/schema - contact-group/schema - group-contact/schema - local-storage/schema - browser/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating v22 account database: " old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/account/v23/chat.cljs b/src/status_im/data_store/realm/schemas/account/v23/chat.cljs deleted file mode 100644 index 1435c982e8..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v23/chat.cljs +++ /dev/null @@ -1,35 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v23.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 :list - :objectType :chat-contact} - :unremovable? {:type :bool - :default false} - :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/v23/contact.cljs b/src/status_im/data_store/realm/schemas/account/v23/contact.cljs deleted file mode 100644 index a220162931..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v23/contact.cljs +++ /dev/null @@ -1,28 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v23.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/v23/core.cljs b/src/status_im/data_store/realm/schemas/account/v23/core.cljs deleted file mode 100644 index 68c536e200..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v23/core.cljs +++ /dev/null @@ -1,62 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v23.core - (:require [status-im.data-store.realm.schemas.account.v23.chat :as chat] - [status-im.data-store.realm.schemas.account.v22.transport :as transport] - [status-im.data-store.realm.schemas.account.v1.chat-contact :as chat-contact] - [status-im.data-store.realm.schemas.account.v23.contact :as contact] - [status-im.data-store.realm.schemas.account.v20.discover :as discover] - [status-im.data-store.realm.schemas.account.v23.message :as message] - [status-im.data-store.realm.schemas.account.v19.request :as request] - [status-im.data-store.realm.schemas.account.v19.user-status :as user-status] - [status-im.data-store.realm.schemas.account.v5.contact-group :as contact-group] - [status-im.data-store.realm.schemas.account.v5.group-contact :as group-contact] - [status-im.data-store.realm.schemas.account.v8.local-storage :as local-storage] - [status-im.data-store.realm.schemas.account.v21.browser :as browser] - [goog.object :as object] - [taoensso.timbre :as log] - [cljs.reader :as reader] - [clojure.string :as string])) - -(def schema [chat/schema - chat-contact/schema - transport/schema - contact/schema - discover/schema - message/schema - request/schema - user-status/schema - contact-group/schema - group-contact/schema - local-storage/schema - browser/schema]) - -(defn update-new-message [new-realm message-id to-clock-value from-clock-value] - (when-let [message (some-> new-realm - (.objects "message") - (.filtered (str "message-id = \"" message-id "\"")) - (aget 0))] - (aset message "to-clock-value" to-clock-value) - (aset message "from-clock-value" from-clock-value))) - -(defn update-chat-messages [old-realm new-realm chat-id] - (let [from-clock-value (atom 0) - to-clock-value (atom 0)] - (some-> old-realm - (.objects "message") - (.filtered (str "chat-id = \"" chat-id "\"")) - (.sorted "clock-value" false) - (.map (fn [message _ _] - (let [message-id (object/get message "message-id") - outgoing? (boolean (object/get message "outgoing"))] - (if outgoing? - (update-new-message new-realm message-id (swap! to-clock-value inc) @from-clock-value) - (update-new-message new-realm message-id @to-clock-value (swap! from-clock-value inc))))))))) - -(defn update-chats [old-realm new-realm] - (some-> new-realm - (.objects "chat") - (.map (fn [chat _ _] - (update-chat-messages old-realm new-realm (object/get chat "chat-id")))))) - -(defn migration [old-realm new-realm] - (log/debug "migrating v23 account database: " old-realm new-realm) - (update-chats old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/account/v23/message.cljs b/src/status_im/data_store/realm/schemas/account/v23/message.cljs deleted file mode 100644 index 3cf5776c8c..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v23/message.cljs +++ /dev/null @@ -1,30 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v23.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} - :from-clock-value {:type :int - :default 0} - :to-clock-value {:type :int - :default 0} - :show? {:type :bool - :default true}}}) 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 125b076a78..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v3/chat.cljs +++ /dev/null @@ -1,40 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v3.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 :list - :objectType :chat-contact} - :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} - :last-message-id :string - :message-overhead {:type :int - :default 0} - :public-key {:type :string - :optional true} - :private-key {:type :string - :optional true} - :contact-info {:type :string - :optional true} - :debug? {:type :bool - :default false}}}) - -(defn migration [old-realm new-realm] - (log/debug "migrating chat schema v3")) diff --git a/src/status_im/data_store/realm/schemas/account/v3/contact.cljs b/src/status_im/data_store/realm/schemas/account/v3/contact.cljs deleted file mode 100644 index d74d5a5010..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v3/contact.cljs +++ /dev/null @@ -1,28 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v3.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} - :status {:type "string" :optional true} - :public-key {:type :string - :optional true} - :private-key {:type :string - :optional true} - :dapp? {:type :bool - :default false} - :dapp-url {:type :string - :optional true} - :dapp-hash {:type :int - :optional true} - :debug? {:type :bool - :default false}}}) - -(defn migration [old-realm new-realm] - (log/debug "migrating contact schema v3")) 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 3eebb58877..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v3/core.cljs +++ /dev/null @@ -1,32 +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.chat-contact :as chat-contact] - [status-im.data-store.realm.schemas.account.v1.command :as command] - [status-im.data-store.realm.schemas.account.v3.contact :as contact] - [status-im.data-store.realm.schemas.account.v1.discover :as discover] - [status-im.data-store.realm.schemas.account.v1.kv-store :as kv-store] - [status-im.data-store.realm.schemas.account.v1.message :as message] - [status-im.data-store.realm.schemas.account.v1.pending-message :as pending-message] - [status-im.data-store.realm.schemas.account.v1.processed-message :as processed-message] - [status-im.data-store.realm.schemas.account.v1.request :as request] - [status-im.data-store.realm.schemas.account.v1.tag :as tag] - [status-im.data-store.realm.schemas.account.v1.user-status :as user-status] - [taoensso.timbre :as log])) - -(def schema [chat/schema - chat-contact/schema - command/schema - contact/schema - discover/schema - kv-store/schema - message/schema - pending-message/schema - processed-message/schema - request/schema - tag/schema - user-status/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating v3 account database: " old-realm new-realm) - (chat/migration old-realm new-realm) - (contact/migration old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/account/v4/chat.cljs b/src/status_im/data_store/realm/schemas/account/v4/chat.cljs deleted file mode 100644 index ce88653e45..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v4/chat.cljs +++ /dev/null @@ -1,42 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v4.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 :list - :objectType :chat-contact} - :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} - :last-message-id :string - :message-overhead {:type :int - :default 0} - :public-key {:type :string - :optional true} - :private-key {:type :string - :optional true} - :contact-info {:type :string - :optional true} - :debug? {:type :bool - :default false} - :public? {:type :bool - :default false}}}) - -(defn migration [old-realm new-realm] - (log/debug "migrating chat schema v4")) 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 b4cfd1e1b8..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v4/core.cljs +++ /dev/null @@ -1,32 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v4.core - (:require [status-im.data-store.realm.schemas.account.v4.chat :as chat] - [status-im.data-store.realm.schemas.account.v1.chat-contact :as chat-contact] - [status-im.data-store.realm.schemas.account.v1.command :as command] - [status-im.data-store.realm.schemas.account.v3.contact :as contact] - [status-im.data-store.realm.schemas.account.v1.discover :as discover] - [status-im.data-store.realm.schemas.account.v1.kv-store :as kv-store] - [status-im.data-store.realm.schemas.account.v4.message :as message] - [status-im.data-store.realm.schemas.account.v1.pending-message :as pending-message] - [status-im.data-store.realm.schemas.account.v1.processed-message :as processed-message] - [status-im.data-store.realm.schemas.account.v1.request :as request] - [status-im.data-store.realm.schemas.account.v1.tag :as tag] - [status-im.data-store.realm.schemas.account.v1.user-status :as user-status] - [taoensso.timbre :as log])) - -(def schema [chat/schema - chat-contact/schema - command/schema - contact/schema - discover/schema - kv-store/schema - message/schema - pending-message/schema - processed-message/schema - request/schema - tag/schema - user-status/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating v4 account database: " old-realm new-realm) - (chat/migration old-realm new-realm) - (contact/migration old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/account/v4/message.cljs b/src/status_im/data_store/realm/schemas/account/v4/message.cljs deleted file mode 100644 index a5c11c3e4d..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v4/message.cljs +++ /dev/null @@ -1,38 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v4.message - (:require [taoensso.timbre :as log])) - -(def schema {:name :message - :primaryKey :message-id - :properties {:message-id :string - :from :string - :to {:type :string - :optional true} - :group-id {: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} - :same-author :bool - :same-direction :bool - :preview {:type :string - :optional true} - :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}}}) - -(defn migration [_ _] - (log/debug "migrating message schema")) 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 13d46af137..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v5/core.cljs +++ /dev/null @@ -1,36 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v5.core - (:require [status-im.data-store.realm.schemas.account.v4.chat :as chat] - [status-im.data-store.realm.schemas.account.v1.chat-contact :as chat-contact] - [status-im.data-store.realm.schemas.account.v1.command :as command] - [status-im.data-store.realm.schemas.account.v3.contact :as contact] - [status-im.data-store.realm.schemas.account.v1.discover :as discover] - [status-im.data-store.realm.schemas.account.v1.kv-store :as kv-store] - [status-im.data-store.realm.schemas.account.v4.message :as message] - [status-im.data-store.realm.schemas.account.v1.pending-message :as pending-message] - [status-im.data-store.realm.schemas.account.v1.processed-message :as processed-message] - [status-im.data-store.realm.schemas.account.v1.request :as request] - [status-im.data-store.realm.schemas.account.v1.tag :as tag] - [status-im.data-store.realm.schemas.account.v1.user-status :as user-status] - [status-im.data-store.realm.schemas.account.v5.contact-group :as contact-group] - [status-im.data-store.realm.schemas.account.v5.group-contact :as group-contact] - [taoensso.timbre :as log])) - -(def schema [chat/schema - chat-contact/schema - command/schema - contact/schema - discover/schema - kv-store/schema - message/schema - pending-message/schema - processed-message/schema - request/schema - tag/schema - user-status/schema - contact-group/schema - group-contact/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating v5 account database: " old-realm new-realm) - (chat/migration old-realm new-realm) - (contact/migration old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/account/v5/group_contact.cljs b/src/status_im/data_store/realm/schemas/account/v5/group_contact.cljs deleted file mode 100644 index c2df25137f..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v5/group_contact.cljs +++ /dev/null @@ -1,8 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v5.group-contact - (:require [taoensso.timbre :as log])) - -(def schema {:name :group-contact - :properties {:identity "string"}}) - -(defn migration [_ _] - (log/debug "migrating group-contact schema v5")) \ No newline at end of file diff --git a/src/status_im/data_store/realm/schemas/account/v6/command.cljs b/src/status_im/data_store/realm/schemas/account/v6/command.cljs deleted file mode 100644 index c1f89a0776..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v6/command.cljs +++ /dev/null @@ -1,26 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v6.command - (:require [taoensso.timbre :as log])) - -(def schema {:name :command - :properties {:description {:type :string - :optional true} - :color {:type :string - :optional true} - :name {:type :string} - :icon {:type :string - :optional true} - :params {:type :list - :objectType :command-parameter} - :title {:type :string - :optional true} - :has-handler {:type :bool - :default true} - :fullscreen {:type :bool - :default true} - :suggestions-trigger {:type :string - :default "on-change"} - :sequential-params {:type :bool - :default false}}}) - -(defn migration [old-realm new-realm] - (log/debug "migrating chat-contact schema v6")) diff --git a/src/status_im/data_store/realm/schemas/account/v6/command_parameter.cljs b/src/status_im/data_store/realm/schemas/account/v6/command_parameter.cljs deleted file mode 100644 index 0c360aa892..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v6/command_parameter.cljs +++ /dev/null @@ -1,9 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v6.command-parameter - (:require [taoensso.timbre :as log])) - -(def schema {:name :command-parameter - :properties {:name {:type :string} - :type {:type :string}}}) - -(defn migration [_ _] - (log/debug "migrating command-parameter schema")) diff --git a/src/status_im/data_store/realm/schemas/account/v6/contact.cljs b/src/status_im/data_store/realm/schemas/account/v6/contact.cljs deleted file mode 100644 index 32c4d0f4e4..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v6/contact.cljs +++ /dev/null @@ -1,47 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v6.contact - (:require [goog.object :as object] - [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} - :status {:type :string :optional true} - :public-key {:type :string - :optional true} - :private-key {:type :string - :optional true} - :dapp? {:type :bool - :default false} - :dapp-url {:type :string - :optional true} - :bot-url {:type :string - :optional true} - :global-command {:type :command - :optional true} - :commands {:type :list - :objectType :command} - :responses {:type :list - :objectType :command} - :dapp-hash {:type :int - :optional true} - :debug? {:type :bool - :default false}}}) - -(defn migration [old-realm new-realm] - (log/debug "migrating contact schema v6") - (let [new-contacts (.objects new-realm "contact")] - (dotimes [i (.-length new-contacts)] - (let [contact (aget new-contacts i) - id (object/get contact "whisper-identity")] - (when (= id "console") - (log/debug (js->clj contact)) - (aset contact "dapp-url" nil) - (aset contact "bot-url" "local://console-bot")) - (when (= id "wallet") - (aset contact "dapp-url" "https://status.im/dapps/wallet/")))))) diff --git a/src/status_im/data_store/realm/schemas/account/v6/core.cljs b/src/status_im/data_store/realm/schemas/account/v6/core.cljs deleted file mode 100644 index 1ae327df58..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v6/core.cljs +++ /dev/null @@ -1,38 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v6.core - (:require [status-im.data-store.realm.schemas.account.v4.chat :as chat] - [status-im.data-store.realm.schemas.account.v1.chat-contact :as chat-contact] - [status-im.data-store.realm.schemas.account.v6.command :as command] - [status-im.data-store.realm.schemas.account.v6.command-parameter :as command-parameter] - [status-im.data-store.realm.schemas.account.v6.contact :as contact] - [status-im.data-store.realm.schemas.account.v1.discover :as discover] - [status-im.data-store.realm.schemas.account.v1.kv-store :as kv-store] - [status-im.data-store.realm.schemas.account.v4.message :as message] - [status-im.data-store.realm.schemas.account.v1.pending-message :as pending-message] - [status-im.data-store.realm.schemas.account.v1.processed-message :as processed-message] - [status-im.data-store.realm.schemas.account.v1.request :as request] - [status-im.data-store.realm.schemas.account.v1.tag :as tag] - [status-im.data-store.realm.schemas.account.v1.user-status :as user-status] - [status-im.data-store.realm.schemas.account.v5.contact-group :as contact-group] - [status-im.data-store.realm.schemas.account.v5.group-contact :as group-contact] - [taoensso.timbre :as log])) - -(def schema [chat/schema - chat-contact/schema - command/schema - command-parameter/schema - contact/schema - discover/schema - kv-store/schema - message/schema - pending-message/schema - processed-message/schema - request/schema - tag/schema - user-status/schema - contact-group/schema - group-contact/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating v6 account database: " old-realm new-realm) - (chat/migration old-realm new-realm) - (contact/migration old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/account/v7/contact.cljs b/src/status_im/data_store/realm/schemas/account/v7/contact.cljs deleted file mode 100644 index 3f9b8f5c27..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v7/contact.cljs +++ /dev/null @@ -1,47 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v7.contact - (:require [goog.object :as object] - [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} - :status {:type :string :optional true} - :public-key {:type :string - :optional true} - :private-key {:type :string - :optional true} - :unremovable? {:type :bool - :default false} - :dapp? {:type :bool - :default false} - :dapp-url {:type :string - :optional true} - :bot-url {:type :string - :optional true} - :global-command {:type :command - :optional true} - :commands {:type :list - :objectType :command} - :responses {:type :list - :objectType :command} - :dapp-hash {:type :int - :optional true} - :debug? {:type :bool - :default false}}}) - -(defn migration [old-realm new-realm] - (log/debug "migrating contact schema v7") - (let [new-contacts (.objects new-realm "contact")] - (dotimes [i (.-length new-contacts)] - (let [contact (aget new-contacts i) - id (object/get contact "whisper-identity")] - (when (or (= id "console") - (= id "wallet") - (= id "browse")) - (aset contact "unremovable?" 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 13f5cb4f57..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v7/core.cljs +++ /dev/null @@ -1,37 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v7.core - (:require [status-im.data-store.realm.schemas.account.v4.chat :as chat] - [status-im.data-store.realm.schemas.account.v1.chat-contact :as chat-contact] - [status-im.data-store.realm.schemas.account.v6.command :as command] - [status-im.data-store.realm.schemas.account.v6.command-parameter :as command-parameter] - [status-im.data-store.realm.schemas.account.v7.contact :as contact] - [status-im.data-store.realm.schemas.account.v1.discover :as discover] - [status-im.data-store.realm.schemas.account.v1.kv-store :as kv-store] - [status-im.data-store.realm.schemas.account.v4.message :as message] - [status-im.data-store.realm.schemas.account.v7.pending-message :as pending-message] - [status-im.data-store.realm.schemas.account.v1.processed-message :as processed-message] - [status-im.data-store.realm.schemas.account.v1.request :as request] - [status-im.data-store.realm.schemas.account.v1.tag :as tag] - [status-im.data-store.realm.schemas.account.v1.user-status :as user-status] - [status-im.data-store.realm.schemas.account.v5.contact-group :as contact-group] - [status-im.data-store.realm.schemas.account.v5.group-contact :as group-contact] - [taoensso.timbre :as log])) - -(def schema [chat/schema - chat-contact/schema - command/schema - command-parameter/schema - contact/schema - discover/schema - kv-store/schema - message/schema - pending-message/schema - processed-message/schema - request/schema - tag/schema - user-status/schema - contact-group/schema - group-contact/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating v7 account database: " old-realm new-realm) - (contact/migration old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/account/v7/pending_message.cljs b/src/status_im/data_store/realm/schemas/account/v7/pending_message.cljs deleted file mode 100644 index ec5a7d7819..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v7/pending_message.cljs +++ /dev/null @@ -1,27 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v7.pending-message - (:require [taoensso.timbre :as log])) - -(def schema {:name :pending-message - :primaryKey :id - :properties {:id :string - :message-id :string - :chat-id {:type :string - :optional true} - :ack? :bool - :requires-ack? :bool - :sig :string - :key :string - :key-type :string - :to {:type :string - :optional true} - :payload :string - :type :string - :topic :string - :attempts :int - :was-sent? :bool}}) - -(defn migration [_ new-realm] - (log/debug "migrating pending-message schema v7") - (let [new-contacts (.objects new-realm "contact")] - (dotimes [i (.-length new-contacts)] - (.delete new-realm (aget new-contacts i))))) 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 eda0ed4eac..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v8/core.cljs +++ /dev/null @@ -1,38 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v8.core - (:require [status-im.data-store.realm.schemas.account.v4.chat :as chat] - [status-im.data-store.realm.schemas.account.v1.chat-contact :as chat-contact] - [status-im.data-store.realm.schemas.account.v6.command :as command] - [status-im.data-store.realm.schemas.account.v6.command-parameter :as command-parameter] - [status-im.data-store.realm.schemas.account.v7.contact :as contact] - [status-im.data-store.realm.schemas.account.v1.discover :as discover] - [status-im.data-store.realm.schemas.account.v1.kv-store :as kv-store] - [status-im.data-store.realm.schemas.account.v4.message :as message] - [status-im.data-store.realm.schemas.account.v7.pending-message :as pending-message] - [status-im.data-store.realm.schemas.account.v1.processed-message :as processed-message] - [status-im.data-store.realm.schemas.account.v1.request :as request] - [status-im.data-store.realm.schemas.account.v1.tag :as tag] - [status-im.data-store.realm.schemas.account.v1.user-status :as user-status] - [status-im.data-store.realm.schemas.account.v5.contact-group :as contact-group] - [status-im.data-store.realm.schemas.account.v5.group-contact :as group-contact] - [status-im.data-store.realm.schemas.account.v8.local-storage :as local-storage] - [taoensso.timbre :as log])) - -(def schema [chat/schema - chat-contact/schema - command/schema - command-parameter/schema - contact/schema - discover/schema - kv-store/schema - message/schema - pending-message/schema - processed-message/schema - request/schema - tag/schema - user-status/schema - contact-group/schema - group-contact/schema - local-storage/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating v8 account database: " old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/account/v9/command_parameter.cljs b/src/status_im/data_store/realm/schemas/account/v9/command_parameter.cljs deleted file mode 100644 index b64e35e2cb..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v9/command_parameter.cljs +++ /dev/null @@ -1,8 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v9.command-parameter - (:require [taoensso.timbre :as log])) - -(def schema {:name :command-parameter - :properties {:name {:type :string} - :type {:type :string} - :placeholder {:type :string - :optional true}}}) 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 eb0afacf6e..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v9/core.cljs +++ /dev/null @@ -1,50 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v9.core - (:require [status-im.data-store.realm.schemas.account.v4.chat :as chat] - [status-im.data-store.realm.schemas.account.v1.chat-contact :as chat-contact] - [status-im.data-store.realm.schemas.account.v6.command :as command] - [status-im.data-store.realm.schemas.account.v9.command-parameter :as command-parameter] - [status-im.data-store.realm.schemas.account.v7.contact :as contact] - [status-im.data-store.realm.schemas.account.v1.discover :as discover] - [status-im.data-store.realm.schemas.account.v1.kv-store :as kv-store] - [status-im.data-store.realm.schemas.account.v4.message :as message] - [status-im.data-store.realm.schemas.account.v7.pending-message :as pending-message] - [status-im.data-store.realm.schemas.account.v1.processed-message :as processed-message] - [status-im.data-store.realm.schemas.account.v1.request :as request] - [status-im.data-store.realm.schemas.account.v1.tag :as tag] - [status-im.data-store.realm.schemas.account.v1.user-status :as user-status] - [status-im.data-store.realm.schemas.account.v5.contact-group :as contact-group] - [status-im.data-store.realm.schemas.account.v5.group-contact :as group-contact] - [status-im.data-store.realm.schemas.account.v8.local-storage :as local-storage] - [goog.object :as object] - [taoensso.timbre :as log])) - -(def schema [chat/schema - chat-contact/schema - command/schema - command-parameter/schema - contact/schema - discover/schema - kv-store/schema - message/schema - pending-message/schema - processed-message/schema - request/schema - tag/schema - user-status/schema - contact-group/schema - group-contact/schema - local-storage/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating v8 account database: " old-realm new-realm) - (let [new-commands (.objects new-realm "command")] - (dotimes [i (.-length new-commands)] - (let [command (aget new-commands i) - command-name (object/get command "name") - command-title (object/get command "title")] - (cond - (and (= command-name "global") (= command-title "Browser")) - (aset command "params" 0 "placeholder" "URL") - - (= command-name "location") - (aset command "params" 0 "placeholder" "Address")))))) 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 0b1b6c850d..88d2e91808 100644 --- a/src/status_im/data_store/realm/schemas/base/core.cljs +++ b/src/status_im/data_store/realm/schemas/base/core.cljs @@ -1,39 +1,7 @@ (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])) + (:require [status-im.data-store.realm.schemas.base.v1.core :as v1])) ;; put schemas ordered by version (def schemas [{:schema v1/schema :schemaVersion 1 - :migration v1/migration} - {:schema v2/schema - :schemaVersion 2 - :migration v2/migration} - {:schema v3/schema - :schemaVersion 3 - :migration v3/migration} - {:schema v4/schema - :schemaVersion 4 - :migration v4/migration} - {:schema v5/schema - :schemaVersion 5 - :migration v5/migration} - {:schema v6/schema - :schemaVersion 6 - :migration v6/migration} - {:schema v7/schema - :schemaVersion 7 - :migration v7/migration} - {:schema v8/schema - :schemaVersion 8 - :migration v8/migration} - {:schema v9/schema - :schemaVersion 9 - :migration v9/migration}]) + :migration v1/migration}]) 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 index 19d34561b6..ccc3f2cf03 100644 --- a/src/status_im/data_store/realm/schemas/base/v1/account.cljs +++ b/src/status_im/data_store/realm/schemas/base/v1/account.cljs @@ -1,23 +1,25 @@ -(ns status-im.data-store.realm.schemas.base.v1.account - (:require [taoensso.timbre :as log])) +(ns status-im.data-store.realm.schemas.base.v1.account) (def schema {:name :account :primaryKey :address :properties {:address :string :public-key :string - :updates-public-key {:type :string - :optional true} - :updates-private-key {:type :string - :optional true} :name {:type :string :optional true} - :phone {: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}}) - -(defn migration [_ _] - (log/debug "migrating account schema")) + :network :string + :networks {:type :list + :objectType :network} + :wnode :string + :settings {:type :string} + :sharing-usage-data? {:type :bool :default false} + :dev-mode? {:type :bool :default false} + :seed-backed-up? {: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 index 6addb40b3f..4c162a81cd 100644 --- a/src/status_im/data_store/realm/schemas/base/v1/core.cljs +++ b/src/status_im/data_store/realm/schemas/base/v1/core.cljs @@ -1,12 +1,10 @@ (ns status-im.data-store.realm.schemas.base.v1.core - (:require [status-im.data-store.realm.schemas.base.v1.account :as account] - [status-im.data-store.realm.schemas.base.v1.kv-store :as kv-store] + (: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 [account/schema - kv-store/schema]) +(def schema [network/schema + account/schema]) (defn migration [old-realm new-realm] - (log/debug "migrating v1 base database: " old-realm new-realm) - (account/migration old-realm new-realm) - (kv-store/migration old-realm new-realm)) \ No newline at end of file + (log/debug "migrating base database v1: " old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/base/v1/kv_store.cljs b/src/status_im/data_store/realm/schemas/base/v1/kv_store.cljs deleted file mode 100644 index 4830de1110..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v1/kv_store.cljs +++ /dev/null @@ -1,10 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v1.kv-store - (:require [taoensso.timbre :as log])) - -(def schema {:name :kv-store - :primaryKey :key - :properties {:key "string" - :value "string"}}) - -(defn migration [_ _] - (log/debug "migrating kv-store schema")) diff --git a/src/status_im/data_store/realm/schemas/base/v4/network.cljs b/src/status_im/data_store/realm/schemas/base/v1/network.cljs similarity index 77% rename from src/status_im/data_store/realm/schemas/base/v4/network.cljs rename to src/status_im/data_store/realm/schemas/base/v1/network.cljs index 26629559cc..6c297f3b89 100644 --- a/src/status_im/data_store/realm/schemas/base/v4/network.cljs +++ b/src/status_im/data_store/realm/schemas/base/v1/network.cljs @@ -1,4 +1,4 @@ -(ns status-im.data-store.realm.schemas.base.v4.network +(ns status-im.data-store.realm.schemas.base.v1.network (:require [taoensso.timbre :as log])) (def schema {:name :network @@ -10,6 +10,3 @@ :optional true} :rpc-url {:type :string :optional true}}}) - -(defn migration [old-realm new-realm] - (log/debug "migrating network schema v4")) 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 4353751abb..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v2/account.cljs +++ /dev/null @@ -1,25 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v2.account - (:require [taoensso.timbre :as log])) - -(def schema {:name :account - :primaryKey :address - :properties {:address :string - :public-key :string - :updates-public-key {:type :string - :optional true} - :updates-private-key {:type :string - :optional true} - :name {:type :string :optional true} - :phone {:type :string :optional true} - :email {:type :string :optional true} - :status {:type :string :optional true} - :debug? {:type :bool :default false} - :photo-path :string - :last-updated {:type :int :default 0} - :signed-up? {:type :bool - :default false} - :network :string}}) - -(defn migration [_ _] - (log/debug "migrating account schema")) - 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 3a9c6bcf1d..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v2/core.cljs +++ /dev/null @@ -1,13 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v2.core - (:require [status-im.data-store.realm.schemas.base.v2.account :as account] - [status-im.data-store.realm.schemas.base.v1.kv-store :as kv-store] - [taoensso.timbre :as log])) - -(def schema [account/schema - kv-store/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating v2 base database: " old-realm new-realm) - (account/migration old-realm new-realm) - (kv-store/migration 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 a16c9f3a98..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v3/account.cljs +++ /dev/null @@ -1,35 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v3.account - (:require [goog.object :as object] - [taoensso.timbre :as log] - [status-im.utils.signing-phrase.core :as signing-phrase])) - -(def schema {:name :account - :primaryKey :address - :properties {:address :string - :public-key :string - :updates-public-key {:type :string - :optional true} - :updates-private-key {:type :string - :optional true} - :name {:type :string :optional true} - :phone {: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} - :last-updated {:type :int :default 0} - :signed-up? {:type :bool - :default false} - :network :string}}) - -(defn migration [_old-realm new-realm] - (log/debug "migrating account schema v3") - (let [accounts (.objects new-realm "account")] - (dotimes [i (.-length accounts)] - (let [account (aget accounts i) - phrase (object/get account "signing-phrase")] - (when (empty? phrase) - (log/debug (js->clj account)) - (aset account "signing-phrase" (signing-phrase/generate))))))) - 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 1a64f625ee..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v3/core.cljs +++ /dev/null @@ -1,12 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v3.core - (:require [status-im.data-store.realm.schemas.base.v3.account :as account] - [status-im.data-store.realm.schemas.base.v1.kv-store :as kv-store] - [taoensso.timbre :as log])) - -(def schema [account/schema - kv-store/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating v3 base database: " old-realm new-realm) - (account/migration 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 94d925c2f4..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v4/account.cljs +++ /dev/null @@ -1,32 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v4.account - (:require [taoensso.timbre :as log] - [status-im.constants :as constants])) - -(def schema {:name :account - :primaryKey :address - :properties {:address :string - :public-key :string - :updates-public-key {:type :string - :optional true} - :updates-private-key {:type :string - :optional true} - :name {:type :string :optional true} - :phone {: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} - :last-updated {:type :int :default 0} - :signed-up? {:type :bool - :default false} - :network :string - :networks {:type :list - :objectType :network}}}) - -(defn migration [_old-realm new-realm] - (log/debug "migrating account schema v4") - (let [accounts (.objects new-realm "account")] - (dotimes [i (.-length accounts)] - (let [account (aget accounts i)] - (aset account "network" constants/default-network))))) 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 c4d609813a..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v4/core.cljs +++ /dev/null @@ -1,14 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v4.core - (:require [status-im.data-store.realm.schemas.base.v4.network :as network] - [status-im.data-store.realm.schemas.base.v4.account :as account] - [taoensso.timbre :as log])) - -(def schema [network/schema - account/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating v4 base database: " old-realm new-realm) - (network/migration old-realm new-realm) - (account/migration 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 1d979c167c..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v5/account.cljs +++ /dev/null @@ -1,29 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v5.account - (:require [taoensso.timbre :as log])) - -(def schema {:name :account - :primaryKey :address - :properties {:address :string - :public-key :string - :updates-public-key {:type :string - :optional true} - :updates-private-key {:type :string - :optional true} - :name {:type :string :optional true} - :phone {: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} - :last-updated {:type :int :default 0} - :signed-up? {:type :bool - :default false} - :network :string - :networks {:type :list - :objectType :network} - :settings {:type :string}}}) - - -(defn migration [old-realm new-realm] - (log/debug "migrating account schema v5")) 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 6fd316421d..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.v4.network :as network] - [status-im.data-store.realm.schemas.base.v5.account :as account] - [taoensso.timbre :as log])) - -(def schema [network/schema - account/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating v5 base database: " 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 9cf70586c2..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v6/account.cljs +++ /dev/null @@ -1,33 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v6.account - (:require [taoensso.timbre :as log] - [status-im.constants :as constants])) - -(def schema {:name :account - :primaryKey :address - :properties {:address :string - :public-key :string - :updates-public-key {:type :string - :optional true} - :updates-private-key {:type :string - :optional true} - :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} - :last-updated {:type :int :default 0} - :signed-up? {:type :bool - :default false} - :network :string - :networks {:type :list - :objectType :network} - :wnode :string - :settings {:type :string}}}) - -(defn migration [_old-realm new-realm] - (log/debug "migrating account schema v6") - (let [accounts (.objects new-realm "account")] - (dotimes [i (.-length accounts)] - (let [account (aget accounts i)] - (aset account "wnode" constants/default-wnode))))) 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 af40cb79cc..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v6/core.cljs +++ /dev/null @@ -1,11 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v6.core - (:require [status-im.data-store.realm.schemas.base.v4.network :as network] - [status-im.data-store.realm.schemas.base.v6.account :as account] - [taoensso.timbre :as log])) - -(def schema [network/schema - account/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating v6 base database: " old-realm new-realm) - (account/migration 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 7dd531ef1e..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v7/account.cljs +++ /dev/null @@ -1,26 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v7.account) - -(def schema {:name :account - :primaryKey :address - :properties {:address :string - :public-key :string - :updates-public-key {:type :string - :optional true} - :updates-private-key {:type :string - :optional true} - :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} - :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} - :wnode :string - :settings {:type :string} - :sharing-usage-data? {:type :bool :default false}}}) \ No newline at end of file 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 db2c059636..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v7/core.cljs +++ /dev/null @@ -1,10 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v7.core - (:require [status-im.data-store.realm.schemas.base.v4.network :as network] - [status-im.data-store.realm.schemas.base.v7.account :as account] - [taoensso.timbre :as log])) - -(def schema [network/schema - account/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating v7 base database: " 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 07ca6bfa5f..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v8/account.cljs +++ /dev/null @@ -1,29 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v8.account) - -(def schema {:name :account - :primaryKey :address - :properties {:address :string - :public-key :string - :updates-public-key {:type :string - :optional true} - :updates-private-key {:type :string - :optional true} - :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} - :wnode :string - :settings {:type :string} - :sharing-usage-data? {:type :bool :default false} - :dev-mode? {:type :bool :default false} - :seed-backed-up? {:type :bool :default false}}}) \ 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 63e2ba42b1..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v8/core.cljs +++ /dev/null @@ -1,10 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v8.core - (:require [status-im.data-store.realm.schemas.base.v4.network :as network] - [status-im.data-store.realm.schemas.base.v8.account :as account] - [taoensso.timbre :as log])) - -(def schema [network/schema - account/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating v8 base database: " 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 97cb60d269..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v9/account.cljs +++ /dev/null @@ -1,25 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v9.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} - :wnode :string - :settings {:type :string} - :sharing-usage-data? {:type :bool :default false} - :dev-mode? {:type :bool :default false} - :seed-backed-up? {:type :bool :default false}}}) 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 4406a01aaf..0000000000 --- a/src/status_im/data_store/realm/schemas/base/v9/core.cljs +++ /dev/null @@ -1,10 +0,0 @@ -(ns status-im.data-store.realm.schemas.base.v9.core - (:require [status-im.data-store.realm.schemas.base.v4.network :as network] - [status-im.data-store.realm.schemas.base.v9.account :as account] - [taoensso.timbre :as log])) - -(def schema [network/schema - account/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating 9 base database: " old-realm new-realm))