Moishi Netzer
04/06/2022, 1:49 PMNurul
04/07/2022, 1:01 PMUser
contains users information.
model Todo
contains the todo information.
model UserTodo
is a connecting table which contains information about a specific user and a specific today for them on a specific date.
model User {
id Int @id @default(autoincrement())
name String
email String @unique
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
UserTodo UserTodo[]
}
model Todo {
id Int @id @default(autoincrement())
title String
UserTodo UserTodo[]
}
model UserTodo {
id Int @id @default(autoincrement())
userId Int @unique
todoId Int @unique
completed Boolean @default(false)
user User @relation(fields: [userId], references: [id])
todo Todo @relation(fields: [todoId], references: [id])
date DateTime
}