prisma-ltree 0.1.1 → 0.2.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/README.md +28 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -73,6 +73,34 @@ export default defineConfig({
|
|
|
73
73
|
|
|
74
74
|
### Contract definition
|
|
75
75
|
|
|
76
|
+
Author ltree columns in either lane — `contract.prisma` (PSL) or `contract.ts`
|
|
77
|
+
(TypeScript). Both emit a byte-identical compiled contract.
|
|
78
|
+
|
|
79
|
+
**PSL lane** — reference the `ltree` namespace constructors (parens required) and compose
|
|
80
|
+
`ltree` into `extensions` in `prisma-next.config.ts`:
|
|
81
|
+
|
|
82
|
+
```prisma
|
|
83
|
+
// contract.prisma — use prisma-next
|
|
84
|
+
|
|
85
|
+
types {
|
|
86
|
+
Path = ltree.Ltree() // → pg/ltree@1 / ltree
|
|
87
|
+
Paths = ltree.LtreeArray() // → pg/ltree-array@1 / ltree[]
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
model Page {
|
|
91
|
+
id String @id @default(uuid())
|
|
92
|
+
path Path
|
|
93
|
+
breadcrumbs Paths
|
|
94
|
+
|
|
95
|
+
@@map("page")
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
`@db.Ltree` is not available — `@db.*` is a closed core table with no extension hook; the
|
|
100
|
+
namespace constructor is the sanctioned surface (the same one pgvector and postgis use).
|
|
101
|
+
|
|
102
|
+
**TypeScript lane**:
|
|
103
|
+
|
|
76
104
|
```typescript
|
|
77
105
|
import { int4Column, textColumn } from "@prisma-next/adapter-postgres/column-types";
|
|
78
106
|
import sqlFamily from "@prisma-next/family-sql/pack";
|