Do some groundwork for supporting the better-sqlite3 driver
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -140,10 +140,9 @@ describe('StaticAssetsStore', () => {
|
||||
const updated = await database('static_assets_cache')
|
||||
.where({ path: 'old' })
|
||||
.update({
|
||||
last_modified_at:
|
||||
database.client.config.client === 'sqlite3'
|
||||
? database.raw(`datetime('now', '-3600 seconds')`)
|
||||
: database.raw(`now() + interval '-3600 seconds'`),
|
||||
last_modified_at: database.client.config.client.includes('sqlite3')
|
||||
? database.raw(`datetime('now', '-3600 seconds')`)
|
||||
: database.raw(`now() + interval '-3600 seconds'`),
|
||||
});
|
||||
expect(updated).toBe(1);
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ export class StaticAssetsStore implements StaticAssetProvider {
|
||||
.where(
|
||||
'last_modified_at',
|
||||
'<=',
|
||||
this.#db.client.config.client === 'sqlite3'
|
||||
this.#db.client.config.client.includes('sqlite3')
|
||||
? this.#db.raw(`datetime('now', ?)`, [`-${maxAgeSeconds} seconds`])
|
||||
: this.#db.raw(`now() + interval '${-maxAgeSeconds} seconds'`),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user