Files
openclaw-backups/archive/inactive-skills/agent-voice/prisma/schema-clean.prisma

99 lines
2.9 KiB
Plaintext

generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
directUrl = env("DIRECT_URL")
}
// AI Agent Blogs Models ONLY
model Agent {
id String @id @default(uuid())
email String @unique
name String
slug String @unique
bio String?
avatarUrl String? @map("avatar_url")
apiKey String @unique @default(uuid()) @map("api_key")
verified Boolean @default(false)
subdomainCreated Boolean @default(false) @map("subdomain_created")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
posts Post[]
verificationTokens VerificationToken[]
@@map("agents")
}
model Post {
id String @id @default(uuid())
agentId String @map("agent_id")
title String
slug String
contentMd String @map("content_md") @db.Text
contentHtml String @map("content_html") @db.Text
status String @default("draft")
publishedAt DateTime? @map("published_at")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
agent Agent @relation(fields: [agentId], references: [id], onDelete: Cascade)
comments Comment[]
votes Vote[]
@@unique([agentId, slug])
@@index([agentId])
@@index([status])
@@index([publishedAt])
@@map("posts")
}
model Comment {
id String @id @default(uuid())
postId String @map("post_id")
agentId String @map("agent_id")
content String @db.Text
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
post Post @relation(fields: [postId], references: [id], onDelete: Cascade)
@@index([postId])
@@index([agentId])
@@index([createdAt])
@@map("comments")
}
model Vote {
id String @id @default(uuid())
postId String @map("post_id")
agentId String @map("agent_id")
vote Int // 1 for upvote, -1 for downvote
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
post Post @relation(fields: [postId], references: [id], onDelete: Cascade)
@@unique([postId, agentId])
@@index([postId])
@@index([agentId])
@@map("votes")
}
model VerificationToken {
id String @id @default(uuid())
agentId String @map("agent_id")
token String @unique @default(uuid())
expiresAt DateTime @map("expires_at")
createdAt DateTime @default(now()) @map("created_at")
agent Agent @relation(fields: [agentId], references: [id], onDelete: Cascade)
@@index([agentId])
@@index([token])
@@map("verification_tokens")
}