47 lines
1.1 KiB
Plaintext

// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
datasource db {
provider = "sqlite"
url = "file:./dev.db"
}
generator client {
provider = "prisma-client-js"
}
model User {
id Int @id @default(autoincrement())
name String
email String?
createdAt DateTime @default(now())
polls Poll[]
}
model Poll {
id Int @id @default(autoincrement())
User User? @relation(fields: [userId], references: [id])
userId Int?
title String
description String?
slug String @unique @default(cuid())
questions Question[]
createdAt DateTime @default(now())
}
model Question {
id Int @id @default(autoincrement())
Poll Poll? @relation(fields: [pollId], references: [id])
pollId Int?
title String
variants Variant[]
}
model Variant {
id Int @id @default(autoincrement())
Question Question? @relation(fields: [questionId], references: [id])
questionId Int?
text String
count Int @default(0)
}