Skip to content

stash-prisma skill: functional-index guidance is stale on Prisma Next 0.17 #895

Description

@coderdan

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    SDKdocumentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions