@easy-cms/db-postgres 1.8.0 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -1
- package/dist/index.js +6 -1
- package/package.json +4 -4
package/dist/index.d.ts
CHANGED
|
@@ -31,7 +31,8 @@ interface PostgresAdapterOptions extends DrizzleAdapterOptions {
|
|
|
31
31
|
readonly applicationName?: string;
|
|
32
32
|
/**
|
|
33
33
|
* Use PGlite (Postgres in WebAssembly) instead of a server: a data directory
|
|
34
|
-
* (relative to the project root), `memory://`, or a PGlite instance you manage
|
|
34
|
+
* (relative to the project root), `memory://`, or a PGlite instance you manage (load
|
|
35
|
+
* `pg_trgm` in it for `index: 'trigram'`).
|
|
35
36
|
* Handy for local development and tests. Requires `@electric-sql/pglite`.
|
|
36
37
|
*/
|
|
37
38
|
readonly pglite?: string | PGlite;
|
package/dist/index.js
CHANGED
|
@@ -30,6 +30,10 @@ var postgresDialect = {
|
|
|
30
30
|
table: (name, columns, indexes) => pgTable(name, columns, indexes),
|
|
31
31
|
index: (name) => index(name),
|
|
32
32
|
uniqueIndex: (name) => uniqueIndex(name),
|
|
33
|
+
// GIN with pg_trgm: `ILIKE '%…%'` (the `like` operator) uses it, in Thai as in English.
|
|
34
|
+
trigramIndex: (name) => ({
|
|
35
|
+
on: (column) => index(name).using("gin", sql`${column} gin_trgm_ops`)
|
|
36
|
+
}),
|
|
33
37
|
serial: (name) => serial(name).primaryKey(),
|
|
34
38
|
text: (name) => text(name),
|
|
35
39
|
integer: (name) => integer(name),
|
|
@@ -125,8 +129,9 @@ async function pgliteConnection(source, cwd) {
|
|
|
125
129
|
let pg;
|
|
126
130
|
if (typeof source === "string") {
|
|
127
131
|
const { PGlite } = await import("@electric-sql/pglite");
|
|
132
|
+
const { pg_trgm } = await import("@electric-sql/pglite/contrib/pg_trgm");
|
|
128
133
|
const dataDir = source.includes("://") || isAbsolute(source) ? source : resolve(cwd, source);
|
|
129
|
-
pg = new PGlite(dataDir);
|
|
134
|
+
pg = new PGlite(dataDir, { extensions: { pg_trgm } });
|
|
130
135
|
} else {
|
|
131
136
|
pg = source;
|
|
132
137
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easy-cms/db-postgres",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "PostgreSQL database adapter for Easy CMS",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
"drizzle-kit": "0.31.11",
|
|
23
23
|
"drizzle-orm": "0.45.4",
|
|
24
24
|
"postgres": "^3.4.9",
|
|
25
|
-
"@easy-cms/drizzle": "^1.
|
|
25
|
+
"@easy-cms/drizzle": "^1.10.0"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@electric-sql/pglite": ">=0.3.0",
|
|
29
|
-
"@easy-cms/core": "^1.
|
|
29
|
+
"@easy-cms/core": "^1.10.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependenciesMeta": {
|
|
32
32
|
"@electric-sql/pglite": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@electric-sql/pglite": "^0.5.8",
|
|
38
|
-
"@easy-cms/core": "^1.
|
|
38
|
+
"@easy-cms/core": "^1.10.0"
|
|
39
39
|
},
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|