From be2a13e90059872a10f7056bf51ae83ca997f50c Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Wed, 7 Dec 2016 11:11:55 +0200 Subject: [PATCH] reset schema version to v1 --- .../realm/schemas/account/core.cljs | 21 +------ .../realm/schemas/account/v1/chat.cljs | 58 ++++++++++++------- .../realm/schemas/account/v1/contact.cljs | 3 +- .../realm/schemas/account/v1/discover.cljs | 19 +++--- .../realm/schemas/account/v1/message.cljs | 6 +- .../realm/schemas/account/v2/contact.cljs | 22 ------- .../realm/schemas/account/v2/core.cljs | 28 --------- .../realm/schemas/account/v3/chat.cljs | 32 ---------- .../realm/schemas/account/v3/core.cljs | 28 --------- .../realm/schemas/account/v3/message.cljs | 34 ----------- .../realm/schemas/account/v4/chat.cljs | 46 --------------- .../realm/schemas/account/v4/core.cljs | 29 ---------- .../realm/schemas/account/v5/core.cljs | 28 --------- .../realm/schemas/account/v5/discover.cljs | 16 ----- 14 files changed, 53 insertions(+), 317 deletions(-) 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/v3/chat.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v3/core.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v3/message.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/v5/core.cljs delete mode 100644 src/status_im/data_store/realm/schemas/account/v5/discover.cljs 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 5e9cd3e00f..393dd465ca 100644 --- a/src/status_im/data_store/realm/schemas/account/core.cljs +++ b/src/status_im/data_store/realm/schemas/account/core.cljs @@ -1,24 +1,7 @@ (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] - )) + (:require [status-im.data-store.realm.schemas.account.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}]) + :migration v1/migration}]) 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 65a4234880..f156279bf1 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 @@ -4,27 +4,41 @@ (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} - :is-active "bool" - :timestamp "int" - :contacts {:type "list" - :objectType "chat-contact"} - :dapp-url {:type :string - :optional true} - :dapp-hash {:type :int - :optional true} - :removed-at {:type :int - :optional true} - :last-message-id "string" - :public-key {:type :string - :optional true} - :private-key {:type :string - :optional true}}}) + :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} + :dapp-url {:type :string + :optional true} + :dapp-hash {:type :int + :optional true} + :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 + :public-key {:type :string + :optional true} + :private-key {:type :string + :optional true} + :clock-value {:type :int + :default 0} + :pending-contact? {:type :bool + :default false} + :contact-info {:type :string + :optional true}}}) (defn migration [old-realm new-realm] - (log/debug "migrating chat schema")) \ No newline at end of file + (log/debug "migrating chat 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 e7bf1279dd..3f8e176f88 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 @@ -10,6 +10,7 @@ :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 @@ -18,4 +19,4 @@ :default false}}}) (defn migration [old-realm new-realm] - (log/debug "migrating contact schema")) \ No newline at end of file + (log/debug "migrating contact schema")) 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 index b6d7daf0fb..7f96cc846c 100644 --- a/src/status_im/data_store/realm/schemas/account/v1/discover.cljs +++ b/src/status_im/data_store/realm/schemas/account/v1/discover.cljs @@ -3,15 +3,14 @@ (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"} - :priority {:type "int" :default 0} - :last-updated "date"}}) + :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 [old-realm new-realm] - (log/debug "migrating discover schema")) \ No newline at end of file + (log/debug "migrating discover schema")) 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 5aa749e36e..305f627beb 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 @@ -26,7 +26,9 @@ :message-status {:type :string :optional true} :user-statuses {:type :list - :objectType "user-status"}}}) + :objectType "user-status"} + :clock-value {:type :int + :default 0}}}) (defn migration [old-realm new-realm] - (log/debug "migrating message schema")) \ No newline at end of file + (log/debug "migrating message schema")) 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 6d743fcff0..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v2/contact.cljs +++ /dev/null @@ -1,22 +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}}}) - -(defn migration [old-realm new-realm] - (log/debug "migrating contact schema")) \ No newline at end of file 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 56d4a064b1..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v2/core.cljs +++ /dev/null @@ -1,28 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v2.core - (:require [taoensso.timbre :as log] - [status-im.data-store.realm.schemas.account.v2.contact :as contact] - [status-im.data-store.realm.schemas.account.v1.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.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.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])) - -(def schema [chat/schema - chat-contact/schema - command/schema - contact/schema - discover/schema - kv-store/schema - message/schema - pending-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)) \ No newline at end of file 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 1aed8766c5..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v3/chat.cljs +++ /dev/null @@ -1,32 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v3.chat - (:require [taoensso.timbre :as log] - [status-im.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} - :is-active "bool" - :timestamp "int" - :contacts {:type "list" - :objectType "chat-contact"} - :dapp-url {:type :string - :optional true} - :dapp-hash {:type :int - :optional true} - :removed-at {:type :int - :optional true} - :last-message-id "string" - :public-key {:type :string - :optional true} - :private-key {:type :string - :optional true} - :clock-value {:type :int - :default 0}}}) - -(defn migration [old-realm new-realm] - (log/debug "migrating chat schema")) \ No newline at end of file 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 20156aca96..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v3/core.cljs +++ /dev/null @@ -1,28 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v3.core - (:require [taoensso.timbre :as log] - [status-im.data-store.realm.schemas.account.v3.chat :as chat] - [status-im.data-store.realm.schemas.account.v3.message :as message] - [status-im.data-store.realm.schemas.account.v2.contact :as contact] - [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.discover :as discover] - [status-im.data-store.realm.schemas.account.v1.kv-store :as kv-store] - [status-im.data-store.realm.schemas.account.v1.pending-message :as pending-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])) - -(def schema [chat/schema - chat-contact/schema - command/schema - contact/schema - discover/schema - kv-store/schema - message/schema - pending-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)) \ No newline at end of file diff --git a/src/status_im/data_store/realm/schemas/account/v3/message.cljs b/src/status_im/data_store/realm/schemas/account/v3/message.cljs deleted file mode 100644 index 0ea03cc85b..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v3/message.cljs +++ /dev/null @@ -1,34 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v3.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" - :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}}}) - -(defn migration [old-realm new-realm] - (log/debug "migrating message schema")) \ No newline at end of file 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 185acef8af..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v4/chat.cljs +++ /dev/null @@ -1,46 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v4.chat - (:require [taoensso.timbre :as log] - [status-im.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} - :dapp-url {:type :string - :optional true} - :dapp-hash {:type :int - :optional true} - :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 - :public-key {:type :string - :optional true} - :private-key {:type :string - :optional true} - :clock-value {:type :int - :default 0} - :pending-contact? {:type :bool - :default false} - :contact-info {:type :string - :optional true}}}) - -(defn migration [_ new-realm] - (let [new-objs (.objects new-realm "chat")] - (dotimes [i (.-length new-objs)] - (aset (aget new-objs i) "pending-contact?" false)))) 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 fd60722989..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v4/core.cljs +++ /dev/null @@ -1,29 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v4.core - (:require [taoensso.timbre :as log] - [status-im.data-store.realm.schemas.account.v4.chat :as chat] - [status-im.data-store.realm.schemas.account.v3.message :as message] - [status-im.data-store.realm.schemas.account.v2.contact :as contact] - [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.discover :as discover] - [status-im.data-store.realm.schemas.account.v1.kv-store :as kv-store] - [status-im.data-store.realm.schemas.account.v1.pending-message :as pending-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])) - -(def schema [chat/schema - chat-contact/schema - command/schema - contact/schema - discover/schema - kv-store/schema - message/schema - pending-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)) 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 9220913458..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v5/core.cljs +++ /dev/null @@ -1,28 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v5.core - (:require [taoensso.timbre :as log] - [status-im.data-store.realm.schemas.account.v4.chat :as chat] - [status-im.data-store.realm.schemas.account.v3.message :as message] - [status-im.data-store.realm.schemas.account.v2.contact :as contact] - [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.v5.discover :as discover] - [status-im.data-store.realm.schemas.account.v1.kv-store :as kv-store] - [status-im.data-store.realm.schemas.account.v1.pending-message :as pending-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])) - -(def schema [chat/schema - chat-contact/schema - command/schema - contact/schema - discover/schema - kv-store/schema - message/schema - pending-message/schema - request/schema - tag/schema - user-status/schema]) - -(defn migration [old-realm new-realm] - (log/debug "migrating v5 account database: " old-realm new-realm)) diff --git a/src/status_im/data_store/realm/schemas/account/v5/discover.cljs b/src/status_im/data_store/realm/schemas/account/v5/discover.cljs deleted file mode 100644 index 9faa907c07..0000000000 --- a/src/status_im/data_store/realm/schemas/account/v5/discover.cljs +++ /dev/null @@ -1,16 +0,0 @@ -(ns status-im.data-store.realm.schemas.account.v5.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 [old-realm new-realm] - (log/debug "migrating discover schema")) \ No newline at end of file