jeep-sqlite
Advanced tools
Comparing version 0.0.7 to 0.0.9
@@ -42,6 +42,20 @@ import initSqlJs from 'sql.js'; | ||
if (this.version > curVersion) { | ||
try { | ||
// execute the upgrade flow process | ||
const changes = await onUpgrade(this.mDb, this.vUpgDict, this.dbName, curVersion, this.version, this.store); | ||
if (changes === -1) { | ||
const keys = Object.keys(this.vUpgDict); | ||
if (keys.length > 0) { | ||
try { | ||
// execute the upgrade flow process | ||
const changes = await onUpgrade(this.mDb, this.vUpgDict, this.dbName, curVersion, this.version, this.store); | ||
if (changes === -1) { | ||
// restore the database from backup | ||
try { | ||
await restoreDBFromStore(this.dbName, 'backup', this.store); | ||
} | ||
catch (err) { | ||
return Promise.reject(new Error(`Open: ${err.message}`)); | ||
} | ||
} | ||
// delete the backup database | ||
await removeDBFromStore(`backup-${this.dbName}`, this.store); | ||
} | ||
catch (err) { | ||
// restore the database from backup | ||
@@ -55,12 +69,9 @@ try { | ||
} | ||
// delete the backup database | ||
await removeDBFromStore(`backup-${this.dbName}`, this.store); | ||
} | ||
catch (err) { | ||
// restore the database from backup | ||
else { | ||
try { | ||
await restoreDBFromStore(this.dbName, 'backup', this.store); | ||
await setVersion(this.mDb, this.version); | ||
} | ||
catch (err) { | ||
return Promise.reject(new Error(`Open: ${err.message}`)); | ||
return Promise.reject(new Error(`SetVersion: ${this.version} ${err.message}`)); | ||
} | ||
@@ -67,0 +78,0 @@ } |
@@ -184,8 +184,14 @@ import { setForeignKeyConstraintsEnabled, setVersion, beginTransaction, rollbackTransaction, commitTransaction, execute, dbChanges, run, queryAll, isTableExists } from './utils-sqlite'; | ||
else { | ||
try { | ||
await rollbackTransaction(db, true); | ||
return Promise.reject(new Error(`CreateTablesData: ${msg}`)); | ||
if (msg.length > 0) { | ||
try { | ||
await rollbackTransaction(db, true); | ||
return Promise.reject(new Error(`CreateTablesData: ${msg}`)); | ||
} | ||
catch (err) { | ||
return Promise.reject(new Error('CreateTablesData: ' + `${err.message}: ${msg}`)); | ||
} | ||
} | ||
catch (err) { | ||
return Promise.reject(new Error('CreateTablesData: ' + `${err.message}: ${msg}`)); | ||
else { | ||
// case were no values given | ||
return Promise.resolve(0); | ||
} | ||
@@ -192,0 +198,0 @@ } |
@@ -1,1 +0,1 @@ | ||
import{p as e,b as t}from"./p-6f7210ce.js";(()=>{const t=import.meta.url,s={};return""!==t&&(s.resourcesUrl=new URL(".",t).href),e(s)})().then((e=>t([["p-b5665653",[[1,"jeep-sqlite",{echo:[64],createConnection:[64],closeConnection:[64],open:[64],close:[64],execute:[64],executeSet:[64],run:[64],query:[64],isDBExists:[64],isDBOpen:[64],deleteDatabase:[64],isStoreOpen:[64],copyFromAssets:[64],isTableExists:[64],createSyncTable:[64],getSyncDate:[64],setSyncDate:[64],isJsonValid:[64],importFromJson:[64],exportToJson:[64],addUpgradeStatement:[64],isDatabase:[64],getDatabaseList:[64],checkConnectionsConsistency:[64]}]]]],e))); | ||
import{p as e,b as t}from"./p-6f7210ce.js";(()=>{const t=import.meta.url,s={};return""!==t&&(s.resourcesUrl=new URL(".",t).href),e(s)})().then((e=>t([["p-98288391",[[1,"jeep-sqlite",{echo:[64],createConnection:[64],closeConnection:[64],open:[64],close:[64],execute:[64],executeSet:[64],run:[64],query:[64],isDBExists:[64],isDBOpen:[64],deleteDatabase:[64],isStoreOpen:[64],copyFromAssets:[64],isTableExists:[64],createSyncTable:[64],getSyncDate:[64],setSyncDate:[64],isJsonValid:[64],importFromJson:[64],exportToJson:[64],addUpgradeStatement:[64],isDatabase:[64],getDatabaseList:[64],checkConnectionsConsistency:[64]}]]]],e))); |
{ | ||
"name": "jeep-sqlite", | ||
"version": "0.0.7", | ||
"version": "0.0.9", | ||
"description": "Browser SQLite Stencil Component", | ||
@@ -41,3 +41,2 @@ "main": "dist/index.cjs.js", | ||
}, | ||
"keywords": [ | ||
@@ -44,0 +43,0 @@ "SQLite", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1483677
31586
26