in src/SqlProviderBase.ts [128:150]
protected _ourVersionChecker(wipeIfExists: boolean): Promise<void> {
return this._getDbVersion()
.then(oldVersion => {
if (oldVersion !== this._schema!!!.version) {
// Needs a schema upgrade/change
if (!wipeIfExists && this._schema!!!.version < oldVersion) {
console.log('Database version too new (' + oldVersion + ') for schema version (' + this._schema!!!.version +
'). Wiping!');
wipeIfExists = true;
}
return this._changeDbVersion(oldVersion, this._schema!!!.version).then(trans => {
return this._upgradeDb(trans, oldVersion, wipeIfExists);
});
} else if (wipeIfExists) {
// No version change, but wipe anyway
return this.openTransaction(undefined, true).then(trans => {
return this._upgradeDb(trans, oldVersion, true);
});
}
return undefined;
});
}