Socket
Socket
Sign inDemoInstall

@capacitor-community/sqlite

Package Overview
Dependencies
Maintainers
14
Versions
241
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@capacitor-community/sqlite - npm Package Compare versions

Comparing version 2.4.1-devversion.2 to 2.4.1-devversion.3

6

CHANGELOG.md

@@ -0,1 +1,7 @@

## 2.4.1-devversion.3 (2020-09-02)
### Added Features
- add Upgrade Database Version documentation
## 2.4.1-devversion.2 (2020-08-31)

@@ -2,0 +8,0 @@

52

dist/esm/electron-utils/DatabaseSQLiteHelper.js

@@ -170,3 +170,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

if (err) {
console.log(`exec: Error Execute command failed : ${err.message}`);
console.log(`execute: Error Execute command failed : ${err.message}`);
resolve(retRes);

@@ -985,25 +985,32 @@ }

}
// set PRAGMA
let pragmas = `
PRAGMA foreign_keys = OFF;
`;
let pchanges = yield this.execute(db, pragmas);
if (pchanges === -1) {
console.log('onUpgrade: Error in setting PRAGMA foreign_keys = OFF');
return false;
}
let retB = yield this.beginTransaction(db);
if (!retB) {
console.log('executeSet: Error beginTransaction failed');
console.log('onUpgrade: Error beginTransaction failed');
return false;
}
// TODO
// -> copy database on temp_dbName
// -> get the list of existing columns in each table of temp_dbName
// Here we assume all the tables schema are given in the upgrade statement
if (upgrade.statement) {
// -> backup all existing tables "tableName" in "temp_tableName"
/* const retB: boolean = await this.backupTables(db, dbName);
if(!retB) {
console.log("onUpgrade Error in backuping existing tables");
return false;
}
*/
// -> upgrading all existing table's schema and creating new one
const result = yield this.execute(db, upgrade.statement);
if (result.changes < 0) {
console.log(`Error PRAGMA user_version failed : Version mismatch! Expected Versi
on ${targetVersion} found Version ${currentVersion}. Upgrade Stateme
nt returned error.`);
console.log(`onUpgrade Error in creating tables `);
return false;
}
}
// TODO
// -> get the list of columns in each table of the database
// -> get the intersection containing all columns in each table
// -> restore the tables data for old existing columns
//
// here we assume that the Set contains only

@@ -1015,5 +1022,3 @@ // - the data for new tables as INSERT statements

if (result.changes < 0) {
console.log(`Error PRAGMA user_version failed : Version mismatch! Expected Versi
on ${targetVersion} found Version ${currentVersion}. Upgrade Stateme
nt Set returned error.`);
console.log('onUpgrade Error executeSet Failed');
return false;

@@ -1023,9 +1028,16 @@ }

yield this.updateDatabaseVersion(db, upgrade.toVersion);
// TODO
// -> DROP all Tables in temp_dbName
retB = yield this.endTransaction(db);
if (!retB) {
console.log('executeSet: Error endTransaction failed');
console.log('updateDatabaseVersion: Error endTransaction failed');
return false;
}
// set PRAGMA
pragmas = `
PRAGMA foreign_keys = ON;
`;
pchanges = yield this.execute(db, pragmas);
if (pchanges === -1) {
console.log('onUpgrade: Error in setting PRAGMA foreign_keys = ON');
return false;
}
/* Can you explain in which cases they will be some more updates to do

@@ -1038,4 +1050,2 @@

*/
// TODO
// -> Delete temp_dbName
return true;

@@ -1042,0 +1052,0 @@ });

{
"name": "@capacitor-community/sqlite",
"version": "2.4.1-devversion.2",
"version": "2.4.1-devversion.3",
"description": "Capacitor SQLite Plugin",

@@ -29,3 +29,3 @@ "homepage": "https://github.com/capacitor-community/sqlite",

"husky": "^4.2.5",
"np": "^6.3.2",
"np": "^6.5.0",
"prettier": "^2.0.5",

@@ -32,0 +32,0 @@ "prettier-plugin-java": "^0.8.1",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc