@prisma/orm-postgres 8.0.0-rc.17-dev.21 → 8.0.0-rc.17-dev.22
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/relational-core__functions.d.mts +1 -0
- package/dist/relational-core__functions.mjs +2 -0
- package/dist/relational-core__index-reference.d.mts +1 -0
- package/dist/relational-core__index-reference.mjs +2 -0
- package/package.json +10 -8
- package/skills/prisma-8/SKILL.md +1 -1
- package/skills/prisma-8/references/queries-postgres.md +16 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@prisma/orm-family-sql/relational-core/functions";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@prisma/orm-family-sql/relational-core/index-reference";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@prisma/orm-postgres",
|
|
3
|
-
"version": "8.0.0-rc.17-dev.
|
|
3
|
+
"version": "8.0.0-rc.17-dev.22",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -10,10 +10,10 @@
|
|
|
10
10
|
"skills"
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@prisma/orm-family-sql": "8.0.0-rc.17-dev.
|
|
14
|
-
"@prisma/orm-framework": "8.0.0-rc.17-dev.
|
|
15
|
-
"@prisma/orm-target-postgres": "8.0.0-rc.17-dev.
|
|
16
|
-
"@prisma/orm-toolchain": "8.0.0-rc.17-dev.
|
|
13
|
+
"@prisma/orm-family-sql": "8.0.0-rc.17-dev.22",
|
|
14
|
+
"@prisma/orm-framework": "8.0.0-rc.17-dev.22",
|
|
15
|
+
"@prisma/orm-target-postgres": "8.0.0-rc.17-dev.22",
|
|
16
|
+
"@prisma/orm-toolchain": "8.0.0-rc.17-dev.22",
|
|
17
17
|
"@types/node": "26.1.2",
|
|
18
18
|
"@types/pg": "8.20.4",
|
|
19
19
|
"arktype": "^2.2.2",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"tinyglobby": "^0.2.17"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@internal/postgres": "8.0.0-rc.17-dev.
|
|
26
|
-
"@repo/tsconfig": "8.0.0-rc.17-dev.
|
|
27
|
-
"@repo/tsdown": "8.0.0-rc.17-dev.
|
|
25
|
+
"@internal/postgres": "8.0.0-rc.17-dev.22",
|
|
26
|
+
"@repo/tsconfig": "8.0.0-rc.17-dev.22",
|
|
27
|
+
"@repo/tsdown": "8.0.0-rc.17-dev.22",
|
|
28
28
|
"tsdown": "0.22.14",
|
|
29
29
|
"typescript": "5.9.3"
|
|
30
30
|
},
|
|
@@ -121,6 +121,8 @@
|
|
|
121
121
|
"./relational-core/codec-descriptor-registry": "./dist/relational-core__codec-descriptor-registry.mjs",
|
|
122
122
|
"./relational-core/contract-free": "./dist/relational-core__contract-free.mjs",
|
|
123
123
|
"./relational-core/expression": "./dist/relational-core__expression.mjs",
|
|
124
|
+
"./relational-core/functions": "./dist/relational-core__functions.mjs",
|
|
125
|
+
"./relational-core/index-reference": "./dist/relational-core__index-reference.mjs",
|
|
124
126
|
"./relational-core/middleware": "./dist/relational-core__middleware.mjs",
|
|
125
127
|
"./relational-core/plan": "./dist/relational-core__plan.mjs",
|
|
126
128
|
"./relational-core/query-lane-context": "./dist/relational-core__query-lane-context.mjs",
|
package/skills/prisma-8/SKILL.md
CHANGED
|
@@ -123,10 +123,25 @@ model('Message', { fields: { id, text } }).sql(({ cols }) => ({
|
|
|
123
123
|
@@fullTextIndex([[title, subtitle], body], name: "post_search")
|
|
124
124
|
```
|
|
125
125
|
|
|
126
|
-
**Searching an index
|
|
126
|
+
**Searching an index: name it.** Name the full-text index and pass it to `fns.fullTextMatches` and `fns.fullTextRank` in place of a column. The operation searches the document the index was built over, with the index's weight groups and language, so the query always matches the index, Postgres uses it, and a title match ranks above a body match. The index states its language, so passing `language` with one is a type error. An index of another type, or a name the model's table does not have, is a type error too.
|
|
127
|
+
|
|
128
|
+
In the ORM, every `where` and `orderBy` callback receives a second argument `{ fns, indexes }`: `fns` is the SQL builder's functions, and `indexes` holds the indexes of the model's table under the name the contract gave each, `name:` or `map:`. A value from `fns`, such as a rank, has `.asc()` and `.desc()`:
|
|
127
129
|
|
|
128
130
|
```typescript
|
|
129
131
|
const q = websearchToTsquery(query);
|
|
132
|
+
const posts = await db.orm.public.Post
|
|
133
|
+
.select('id', 'title')
|
|
134
|
+
.where((_p, { fns, indexes }) => fns.fullTextMatches(indexes.post_search, q))
|
|
135
|
+
.orderBy((_p, { fns, indexes }) => fns.fullTextRank(indexes.post_search, q).desc())
|
|
136
|
+
.limit(20)
|
|
137
|
+
.all();
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
The same argument reaches the callbacks inside an include refinement, a fragment and a relation filter (`some`, `every`, `none`), where the index's columns follow the alias the ORM gives the related table. A condition from `fns` combines with the ORM's `and`, `or` and `not`. The body of a fragment for any model (`db.orm.fragment(fields, body)`) gets `fns` but no indexes.
|
|
141
|
+
|
|
142
|
+
In the SQL builder, a table's `indexes` holds the same references:
|
|
143
|
+
|
|
144
|
+
```typescript
|
|
130
145
|
const post = db.sql.public.post;
|
|
131
146
|
const posts = post
|
|
132
147
|
.select('id', 'title')
|