mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-22 21:01:31 +03:00
Fixed pin code default issue, fixed realm migration
This commit is contained in:
parent
37c932a06c
commit
0454308e0a
@ -84,22 +84,14 @@ const realm = new Realm({
|
|||||||
path: 'esteem.realm',
|
path: 'esteem.realm',
|
||||||
schema: [userSchema, authSchema, draftSchema, settingsSchema, applicationSchema, scAccounts],
|
schema: [userSchema, authSchema, draftSchema, settingsSchema, applicationSchema, scAccounts],
|
||||||
schemaVersion: 3,
|
schemaVersion: 3,
|
||||||
migration,
|
migration: (oldRealm, newRealm) => {
|
||||||
|
if (oldRealm.schemaVersion < 3 && newRealm.schemaVersion > 2) {
|
||||||
|
const newObjects = newRealm.objects(SETTINGS_SCHEMA);
|
||||||
|
newObjects[0].isPinCodeOpen = true;
|
||||||
|
}
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const migration = (oldRealm, newRealm) => {
|
|
||||||
// EXAMPLE
|
|
||||||
// // only apply this change if upgrading to schemaVersion 1
|
|
||||||
// if (oldRealm.schemaVersion < 1) {
|
|
||||||
// const oldObjects = oldRealm.objects('Person');
|
|
||||||
// const newObjects = newRealm.objects('Person');
|
|
||||||
// // loop through all objects and set the name property in the new schema
|
|
||||||
// for (let i = 0; i < oldObjects.length; i++) {
|
|
||||||
// newObjects[i].name = `${oldObjects[i].firstName} ${oldObjects[i].lastName}`;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
};
|
|
||||||
|
|
||||||
const settings = realm.objects(SETTINGS_SCHEMA);
|
const settings = realm.objects(SETTINGS_SCHEMA);
|
||||||
|
|
||||||
if (Array.from(settings).length <= 0) {
|
if (Array.from(settings).length <= 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user