Fix latest nightly -> nigthly migration

This commit is contained in:
janherich 2018-02-15 10:53:54 +01:00
parent 7e4903826f
commit fb4ea0572b
No known key found for this signature in database
GPG Key ID: C23B473AFBE94D13
5 changed files with 79 additions and 4 deletions

View File

@ -19,7 +19,8 @@
[status-im.data-store.realm.schemas.account.v18.core :as v18] [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.v19.core :as v19]
[status-im.data-store.realm.schemas.account.v20.core :as v20] [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. ;; TODO(oskarth): Add failing test if directory vXX exists but isn't in schemas.
@ -87,5 +88,8 @@
:migration v20/migration} :migration v20/migration}
{:schema v21/schema {:schema v21/schema
:schemaVersion 21 :schemaVersion 21
:migration v21/migration}]) :migration v21/migration}
{:schema v22/schema
:schemaVersion 22
:migration v22/migration}])

View File

@ -24,7 +24,7 @@
:added-to-at {:type :int :added-to-at {:type :int
:optional true} :optional true}
:updated-at {:type :int :updated-at {:type :int
:optional true} :optional true}
:message-overhead {:type :int :message-overhead {:type :int
:default 0} :default 0}
:public-key {:type :string :public-key {:type :string

View File

@ -1,5 +1,5 @@
(ns status-im.data-store.realm.schemas.account.v21.core (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.v1.chat-contact :as chat-contact]
[status-im.data-store.realm.schemas.account.v19.contact :as 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.v20.discover :as discover]

View File

@ -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}}})

View File

@ -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))