prisma-ltree
PostgreSQL ltree extension for Prisma Next
PostgreSQL ltree brings hierarchical tree data to Prisma Next. This extension pack gives you typed codecs, query operators, and a baseline migration for tree-structured data, with no raw SQL.
Author your contract in either lane and get the same compiled result:
- PSL:
contract.prismawithltree.Ltree()andltree.LtreeArray() - TypeScript:
contract.tswithdefineContractandltree()/ltreeArray()
See Authoring Contracts for side-by-side examples. The Getting Started guide covers install, runtime wiring, migrations, and your first queries.
What is ltree?
The PostgreSQL ltree type stores dot-separated path labels (e.g. Top.Science.Astronomy). It fits org hierarchies, category trees, taxonomies, and any model where ancestor or descendant queries matter.
Query Operations
- Hierarchy Operators: ancestor and descendant checks
- Pattern Matching Operators:
lqueryandltxtquerypatterns - Lowest Common Ancestor: shared ancestor of paths, including
ltree[]columns