mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-22 03:50:30 +00:00
feat(db): keep SQLite's write and search semantics on Postgres
- UnitOfWork transactions take one advisory lock for the database on Postgres (DatabaseEngine.serializeWrites, pg_advisory_xact_lock), so a MAX(...) + 1 read inside one cannot race another, as with SQLite's single writer. SQLite needs nothing. - ilike(platform, refs) builds the case-insensitive search condition: LIKE on SQLite, ILIKE on Postgres, where LIKE is exact. The place searches use it. - Plugin data erasure runs each statement in its own savepoint: on Postgres a failed statement would abort the user's whole erasure transaction.
This commit is contained in:
@@ -44,6 +44,7 @@ import {
|
||||
dateOf,
|
||||
dayDistance,
|
||||
foundAgainState,
|
||||
ilike,
|
||||
lower,
|
||||
lowerParam,
|
||||
lowerTrim,
|
||||
@@ -269,6 +270,18 @@ export const HELPER_CASES: readonly HelperCase[] = [
|
||||
raw: (p) => rawOf(dayDistance(p, 'a', '2026-09-24')),
|
||||
expect: { equals: 3 },
|
||||
},
|
||||
{
|
||||
name: 'ilike matches in other case',
|
||||
row: { a: 'Probe Place' },
|
||||
raw: (p) => ({ sql: ilike(p, ['a']), params: ['%PLACE%'] }),
|
||||
expect: { equals: true },
|
||||
},
|
||||
{
|
||||
name: 'ilike keeps the escaped wildcard literal',
|
||||
row: { a: 'Probe Place' },
|
||||
raw: (p) => ({ sql: ilike(p, ['a']), params: ['probe\\_place'] }),
|
||||
expect: { equals: false },
|
||||
},
|
||||
{
|
||||
name: 'collateNoCase',
|
||||
row: { a: 'Probe' },
|
||||
|
||||
Reference in New Issue
Block a user