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 f6b30d9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 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
6 changes: 3 additions & 3 deletions src/driver/capacitor/CapacitorQueryRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ export class CapacitorQueryRunner extends AbstractSqliteQueryRunner {
* Called before migrations are run.
*/
async beforeMigration(): Promise<void> {
await this.query(`PRAGMA foreign_keys = OFF`)
await this.run(`PRAGMA foreign_keys = OFF`)
}

/**
* Called after migrations are run.
*/
async afterMigration(): Promise<void> {
await this.query(`PRAGMA foreign_keys = ON`)
await this.run(`PRAGMA foreign_keys = ON`)
}

async executeSet(set: { statement: string; values?: any[] }[]) {
Expand Down 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 f6b30d9

Please sign in to comment.