From fb4ea0572bc365e34867282c7e550acebb3d0f6e Mon Sep 17 00:00:00 2001 From: janherich Date: Thu, 15 Feb 2018 10:53:54 +0100 Subject: [PATCH] Fix latest nightly -> nigthly migration --- .../realm/schemas/account/core.cljs | 8 +++- .../realm/schemas/account/v19/chat.cljs | 2 +- .../realm/schemas/account/v21/core.cljs | 2 +- .../realm/schemas/account/v22/chat.cljs | 37 +++++++++++++++++++ .../realm/schemas/account/v22/core.cljs | 34 +++++++++++++++++ 5 files changed, 79 insertions(+), 4 deletions(-) create mode 100644 src/status_im/data_store/realm/schemas/account/v22/chat.cljs create mode 100644 src/status_im/data_store/realm/schemas/account/v22/core.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 e05d43d774..b490dceecb 100644 --- a/src/status_im/data_store/realm/schemas/account/core.cljs +++ b/src/status_im/data_store/realm/schemas/account/core.cljs @@ -19,7 +19,8 @@ [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.v21.core :as v21] + [status-im.data-store.realm.schemas.account.v22.core :as v22])) ;; TODO(oskarth): Add failing test if directory vXX exists but isn't in schemas. @@ -87,5 +88,8 @@ :migration v20/migration} {:schema v21/schema :schemaVersion 21 - :migration v21/migration}]) + :migration v21/migration} + {:schema v22/schema + :schemaVersion 22 + :migration v22/migration}]) 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 index 25aeafc4e0..b888245a14 100644 --- a/src/status_im/data_store/realm/schemas/account/v19/chat.cljs +++ b/src/status_im/data_store/realm/schemas/account/v19/chat.cljs @@ -24,7 +24,7 @@ :added-to-at {:type :int :optional true} :updated-at {:type :int - :optional true} + :optional true} :message-overhead {:type :int :default 0} :public-key {:type :string 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 index d56508ea7a..8a8b24117d 100644 --- a/src/status_im/data_store/realm/schemas/account/v21/core.cljs +++ b/src/status_im/data_store/realm/schemas/account/v21/core.cljs @@ -1,5 +1,5 @@ (ns status-im.data-store.realm.schemas.account.v21.core - (:require [status-im.data-store.realm.schemas.account.v21.chat :as chat] + (: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] 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 new file mode 100644 index 0000000000..dd643807cf --- /dev/null +++ b/src/status_im/data_store/realm/schemas/account/v22/chat.cljs @@ -0,0 +1,37 @@ +(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 new file mode 100644 index 0000000000..aa14142705 --- /dev/null +++ b/src/status_im/data_store/realm/schemas/account/v22/core.cljs @@ -0,0 +1,34 @@ +(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.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 migration [old-realm new-realm] + (log/debug "migrating v22 account database: " old-realm new-realm))