Problem
skills/stash-prisma/SKILL.md ("Indexing encrypted columns") states:
schema.prisma cannot express functional indexes (@@index takes fields, not expressions), so the schema file is not an option.
and prescribes hand-written rawSql migration operations as the only way to create the eql_v3.* functional indexes.
This was true on 0.16 but is false on Prisma Next 0.17 (the surface #749 just moved us to). Verified against the installed @prisma/orm-family-sql@0.17.0 dist:
- PSL
@@index accepts named args expression, where, unique, name/map, type, options, with validation (expression XOR fields; an expression index requires name or map; options requires type).
- The TS contract builder's
index() accepts the {expression, ...} form.
- target-postgres renders
CREATE [UNIQUE] INDEX ... USING <type> (<expression>) WITH (...) WHERE (...) (pgRenderCreateIndex).
So a user can write, directly in schema.prisma:
@@index(expression: "eql_v3.eq_term(email)", name: "users_email_eq", type: "btree")
@@index(expression: "eql_v3.match_term(bio)", name: "users_bio_match", type: "gin")
Fix
- Rewrite the "Indexing encrypted columns" section around the
@@index(expression:) form as the primary recipe; keep rawSql as the fallback and the home of ANALYZE.
- Check
skills/stash-indexing/SKILL.md for the same claim / cross-references.
- Skills ship in the
stash tarball → needs a stash patch changeset.
Auto-generating these indexes from the codec (no user-authored index at all) is the larger follow-up, tracked separately.
Problem
skills/stash-prisma/SKILL.md("Indexing encrypted columns") states:and prescribes hand-written
rawSqlmigration operations as the only way to create theeql_v3.*functional indexes.This was true on 0.16 but is false on Prisma Next 0.17 (the surface #749 just moved us to). Verified against the installed
@prisma/orm-family-sql@0.17.0dist:@@indexaccepts named argsexpression,where,unique,name/map,type,options, with validation (expression XOR fields; an expression index requiresnameormap;optionsrequirestype).index()accepts the{expression, ...}form.CREATE [UNIQUE] INDEX ... USING <type> (<expression>) WITH (...) WHERE (...)(pgRenderCreateIndex).So a user can write, directly in
schema.prisma:Fix
@@index(expression:)form as the primary recipe; keeprawSqlas the fallback and the home ofANALYZE.skills/stash-indexing/SKILL.mdfor the same claim / cross-references.stashtarball → needs astashpatch changeset.Auto-generating these indexes from the codec (no user-authored index at all) is the larger follow-up, tracked separately.