prisma-schemalisted
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`.