forked from typeorm/typeorm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: backport SQLite Busy handler & WAL mode enable (typeorm#6588)
* added sqlitebusy handling logic * added sqlite wal mode enable logic * cleaner if block * move pragma journal mode setting to driver connection * add enable-wal test Co-authored-by: Umed Khudoiberdiev <zarrhost@gmail.com>
- Loading branch information
1 parent
fa56407
commit 1de96bd
Showing
4 changed files
with
72 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import "reflect-metadata"; | ||
import {expect} from "chai"; | ||
import {Connection} from "../../../src/connection/Connection"; | ||
import {closeTestingConnections, createTestingConnections, reloadTestingDatabases} from "../../utils/test-utils"; | ||
|
||
describe("sqlite driver > enable wal", () => { | ||
let connections: Connection[]; | ||
before(async () => connections = await createTestingConnections({ | ||
entities: [], | ||
enabledDrivers: ["sqlite"], | ||
driverSpecific: { | ||
enableWAL: true | ||
} | ||
})); | ||
beforeEach(() => reloadTestingDatabases(connections)); | ||
after(() => closeTestingConnections(connections)); | ||
|
||
it("should set the journal mode as expected", () => Promise.all(connections.map(async connection => { | ||
// if we come this far, test was successful as a connection was established | ||
const result = await connection.query('PRAGMA journal_mode'); | ||
|
||
expect(result).to.eql([{ journal_mode: 'wal'}]); | ||
}))); | ||
}); |