Prisma
Installation
SKILL.md
Schema Design Traps
@default(cuid())over@default(uuid())for IDs—shorter, URL-safe, still unique@updatedAtdoesn't update on nested writes—must touch parent record explicitly- Implicit many-to-many creates join table you can't customize—use explicit for extra fields
@uniqueon nullable field allows multiple NULLs—intended behavior but often surprising- Enum changes require migration—can't add values without downtime unless using String
Query Patterns I Forget
findUniqueOrThrow/findFirstOrThrow—cleaner than null check after findUniquecreateManyskips hooks and returns count only—usecreatein loop if you need records backupsertrequires unique field in where—can't upsert on non-unique compound conditionsconnectOrCreatein nested writes—avoids separate existence checkselectandincludeare mutually exclusive—can't mix; use nested select inside include