feat: add pg_trgm extension in PGlite constructor

This commit is contained in:
P. Reis 2024-09-13 10:24:33 -03:00
parent 8bc8712cf3
commit b5aefdd93e

View file

@ -1,4 +1,5 @@
import { PGlite } from '@electric-sql/pglite'; import { PGlite } from '@electric-sql/pglite';
import { pg_trgm } from '@electric-sql/pglite/contrib/pg_trgm';
import { PgliteDialect } from '@soapbox/kysely-pglite'; import { PgliteDialect } from '@soapbox/kysely-pglite';
import { Kysely } from 'kysely'; import { Kysely } from 'kysely';
@ -10,7 +11,7 @@ export class DittoPglite {
static create(databaseUrl: string): DittoDatabase { static create(databaseUrl: string): DittoDatabase {
const kysely = new Kysely<DittoTables>({ const kysely = new Kysely<DittoTables>({
dialect: new PgliteDialect({ dialect: new PgliteDialect({
database: new PGlite(databaseUrl), database: new PGlite(databaseUrl, { extensions: { pg_trgm } }),
}), }),
log: KyselyLogger, log: KyselyLogger,
}); });