← ClaudeAtlas

prisma-schemalisted

Create or modify Prisma schema for new entities using multi-schema by default. Use this skill when the user wants to define database models, add tables, create migrations, or design a schema with proper field types, relations, indexes, and conventions. Triggers on "prisma schema", "add model", "create table", "database schema", "define entity", or when the user mentions Prisma and needs a model defined. Covers multi-schema, soft deletes, high-precision decimals, snake_case mapping, UUID primary keys, and relation patterns.
widnyana/eyay-toolkits · ★ 4 · API & Backend · score 77
Install: claude install-skill widnyana/eyay-toolkits
# Prisma Schema Create/modify schema for: $ARGUMENTS ## Multi-Schema Setup Always define `schemas` in the datasource block. This enables organizing models into logical namespaces and is supported by PostgreSQL, CockroachDB, and SQL Server. ```prisma generator client { provider = "prisma-client" output = "./generated" } datasource db { provider = "postgresql" url = env("DATABASE_URL") schemas = ["base", "billing", "inventory"] } ``` Every model and enum must declare its schema with `@@schema("name")`. Pick the schema that matches the model's domain. If only one schema is needed, use a single entry like `schemas = ["public"]`. ## Schema Pattern ```prisma model EntityName { id String @id @default(uuid()) createdAt DateTime @default(now()) @map("created_at") updatedAt DateTime @updatedAt @map("updated_at") deletedAt DateTime? @map("deleted_at") // Business fields status EntityStatus @default(ACTIVE) name String amount Decimal @db.Decimal(36, 18) // Relations accountId String @map("account_id") account Account @relation(fields: [accountId], references: [id]) // Indexes @@index([accountId]) @@index([status]) @@index([createdAt]) // Table and schema mapping @@map("entity_names") @@schema("base") } enum EntityStatus { ACTIVE INACTIVE DELETED @@schema("base") } ``` ### Cross-Schema Relations Models in different schemas can reference each other. Both schemas must be listed in `schemas`.