Create Prisma schema models with relations and indexes. Use when designing database schemas, adding models, or defining entity relationships.
// prisma/schema.prisma - NEVER change these blocks
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
Import: import { prisma } from '@/lib/prisma' (already exists)
model Product {
id String @id @default(uuid())
name String
price Float // Use Float for UI (returns number directly)
isActive Boolean @default(true)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
category Category @relation(fields: [categoryId], references: [id], onDelete: Cascade)
categoryId String
@@index([categoryId])
@@index([name])
}
Rules:
@id @default(uuid())createdAt, updatedAt@@index on foreign keys| Type | Returns | Use Case |
|------|---------|----------|
| Int | number | Counts, whole numbers |
| Float | number | Prices (recommended) |
| Decimal | Prisma.Decimal | Financial (needs conversion) |
model Category {
id String @id @default(uuid())
name String @unique
products Product[]
}
model Product {
id String @id @default(uuid())
category Category @relation(fields: [categoryId], references: [id], onDelete: Cascade)
categoryId String
@@index([categoryId])
}
model User {
id String @id @default(uuid())
profile Profile?
}
model Profile {
id String @id @default(uuid())
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
userId String @unique // @unique = one-to-one
}
model Post {
id String @id @default(uuid())
tags Tag[] // Prisma handles junction table
}
model Tag {
id String @id @default(uuid())
name String @unique
posts Post[]
}
User, Account, Session already exist in boilerplate. Just add relations:
model User {
// ... existing fields
posts Post[] // Add your relations
}
DO NOT run db push manually. Runs automatically in validation phase.
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer