diff --git a/docs/TypeORM-Usage-From-5.6.0.md b/docs/TypeORM-Usage-From-5.6.0.md index 977c04c4..be95d59e 100644 --- a/docs/TypeORM-Usage-From-5.6.0.md +++ b/docs/TypeORM-Usage-From-5.6.0.md @@ -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. @@ -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) {' ); @@ -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);' ); @@ -296,7 +284,7 @@ const correctBugInCapacitorDriver = (file) => { }); }); } else { - utils.warn(`Couldn't find file ${file}`); + console.log(`Couldn't find file ${file}`); } }