remove v2 from base database

This commit is contained in:
Roman Volosovskyi 2016-12-11 12:59:21 +02:00
parent b6b46d19af
commit 85e7c6c1f1
4 changed files with 13 additions and 53 deletions

View File

@ -1,11 +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]))
(: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}])
:migration v1/migration}])

View File

@ -3,20 +3,21 @@
(def schema {:name :account
:primaryKey :address
:properties {:address "string"
:public-key "string"
: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}
:photo-path "string"
:last-updated {:type "int" :default 0}
:name {:type :string :optional true}
:phone {:type :string :optional true}
:email {:type :string :optional true}
:status {:type :string :optional true}
:photo-path :string
:last-updated {:type :int :default 0}
:signed-up? {:type :bool
:default false}}})
:default false}
:network :string}})
(defn migration [old-realm new-realm]
(log/debug "migrating account schema"))
(log/debug "migrating account schema"))

View File

@ -1,26 +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}
:photo-path :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 v2")
(let [new-objs (.objects new-realm "account")]
(dotimes [i (.-length new-objs)]
(aset (aget new-objs i) "network" "testnet"))))

View File

@ -1,11 +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))