Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 5 additions & 17 deletions docs/TypeORM-Usage-From-5.6.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export const getCountOfElements = (async (connection: DataSource, entity:any):

## Correcting a Bug in the TypeOrm Capacitor Driver

- the bug is referenced "PRAGMA must run under query method in Capacitor sqlite #10687" in the typeorm/issues and it is for `typeorm release > 3.0.18`.
- the bug is referenced "PRAGMA must run under query method in Capacitor sqlite #10687" in the typeorm/issues and it is for `typeorm release > 0.3.18 and < 0.3.24`.

- create a `scripts` directory at the root of the App.

Expand All @@ -227,20 +227,8 @@ const correctBugInCapacitorQueryRunner = (file) => {
console.warn(`${isModifiedKey} found. Package probably fixed.`);
return;
}

const index = data.indexOf(`"DROP",`)
if (index === -1) {
console.warn('Line not found. Package probably fixed.');
return;
}

var result = data.replace(
` "DROP",`,
` "DROP",
"PRAGMA"`

);
result = result.replace(

let result = data.replace(
'else if (["INSERT", "UPDATE", "DELETE", "PRAGMA"].indexOf(command) !== -1) {',
'else if (["INSERT", "UPDATE", "DELETE"].indexOf(command) !== -1) {'
);
Expand Down Expand Up @@ -279,7 +267,7 @@ const correctBugInCapacitorDriver = (file) => {
return;
}

var result = data.replace(
let result = data.replace(
'await connection.run(`PRAGMA foreign_keys = ON`);',
'await connection.execute(`PRAGMA foreign_keys = ON`, false);'
);
Expand All @@ -296,7 +284,7 @@ const correctBugInCapacitorDriver = (file) => {
});
});
} else {
utils.warn(`Couldn't find file ${file}`);
console.log(`Couldn't find file ${file}`);
}
}

Expand Down