Skip to content

Commit

Permalink
typeorm#10687 Fixing regression caused by typeorm#10273 by reverting…
Browse files Browse the repository at this point in the history
… back to .run() instead of .query() for all PRAGMA calls.
  • Loading branch information
Matt Barnes committed Mar 13, 2024
1 parent 83567f5 commit 66749ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/driver/capacitor/CapacitorDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ export class CapacitorDriver extends AbstractSqliteDriver {

// we need to enable foreign keys in sqlite to make sure all foreign key related features
// working properly. this also makes onDelete to work with sqlite.
await connection.run(`PRAGMA foreign_keys = ON`)
await connection.query(`PRAGMA foreign_keys = ON`)

if (
this.options.journalMode &&
["DELETE", "TRUNCATE", "PERSIST", "MEMORY", "WAL", "OFF"].indexOf(
this.options.journalMode,
) !== -1
) {
await connection.run(
await connection.query(
`PRAGMA journal_mode = ${this.options.journalMode}`,
)
}
Expand Down
2 changes: 1 addition & 1 deletion src/driver/capacitor/CapacitorQueryRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class CapacitorQueryRunner extends AbstractSqliteQueryRunner {
) {
raw = await databaseConnection.execute(query, false)
} else if (
["INSERT", "UPDATE", "DELETE", "PRAGMA"].indexOf(command) !== -1
["INSERT", "UPDATE", "DELETE"].indexOf(command) !== -1
) {
raw = await databaseConnection.run(query, parameters, false)
} else {
Expand Down

0 comments on commit 66749ba

Please sign in to comment.