Skip to content

Commit 23cd60a

Browse files
authored
docs: Fix TypeORM CapacitorDriver PRAGMA Statement Execution for Schema Synchronization (#640)
* Remove Drop statements from correctBugInCapacitorQueryRunner script docs * Add mention of working TypeORM versions for Capacitor bug Clarified the range of TypeORM versions affected by the Capacitor driver bug. This ensures accurate guidance for developers using versions between 0.3.18 and 0.3.24.
1 parent 40c14c2 commit 23cd60a

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

docs/TypeORM-Usage-From-5.6.0.md

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ export const getCountOfElements = (async (connection: DataSource, entity:any):
200200

201201
## Correcting a Bug in the TypeOrm Capacitor Driver
202202

203-
- 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`.
203+
- 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`.
204204

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

@@ -227,20 +227,8 @@ const correctBugInCapacitorQueryRunner = (file) => {
227227
console.warn(`${isModifiedKey} found. Package probably fixed.`);
228228
return;
229229
}
230-
231-
const index = data.indexOf(`"DROP",`)
232-
if (index === -1) {
233-
console.warn('Line not found. Package probably fixed.');
234-
return;
235-
}
236-
237-
var result = data.replace(
238-
` "DROP",`,
239-
` "DROP",
240-
"PRAGMA"`
241-
242-
);
243-
result = result.replace(
230+
231+
let result = data.replace(
244232
'else if (["INSERT", "UPDATE", "DELETE", "PRAGMA"].indexOf(command) !== -1) {',
245233
'else if (["INSERT", "UPDATE", "DELETE"].indexOf(command) !== -1) {'
246234
);
@@ -279,7 +267,7 @@ const correctBugInCapacitorDriver = (file) => {
279267
return;
280268
}
281269

282-
var result = data.replace(
270+
let result = data.replace(
283271
'await connection.run(`PRAGMA foreign_keys = ON`);',
284272
'await connection.execute(`PRAGMA foreign_keys = ON`, false);'
285273
);
@@ -296,7 +284,7 @@ const correctBugInCapacitorDriver = (file) => {
296284
});
297285
});
298286
} else {
299-
utils.warn(`Couldn't find file ${file}`);
287+
console.log(`Couldn't find file ${file}`);
300288
}
301289
}
302290

0 commit comments

Comments
 (0)