fix: fix database schema necessary for auth
This commit is contained in:
parent
22757a16a1
commit
dd99444481
@ -36,37 +36,49 @@ model PrintJob {
|
||||
User User @relation(fields: [user_id], references: [id])
|
||||
}
|
||||
|
||||
// NextAuth Schema
|
||||
// Necessary for Next auth
|
||||
model Account {
|
||||
id String @id @unique
|
||||
id String @id @default(cuid())
|
||||
userId String
|
||||
type String
|
||||
provider String
|
||||
providerAccountId String
|
||||
refresh_token String
|
||||
access_token String
|
||||
expires_at Int
|
||||
token_type String
|
||||
scope String
|
||||
id_token String
|
||||
session_state String
|
||||
User User @relation(fields: [userId], references: [id])
|
||||
refresh_token String? // @db.Text
|
||||
access_token String? // @db.Text
|
||||
expires_at Int?
|
||||
token_type String?
|
||||
scope String?
|
||||
id_token String? // @db.Text
|
||||
session_state String?
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
|
||||
@@unique([provider, providerAccountId])
|
||||
}
|
||||
|
||||
model Session {
|
||||
id String @id @unique
|
||||
id String @id @default(cuid())
|
||||
sessionToken String @unique
|
||||
userId String
|
||||
expires DateTime
|
||||
User User @relation(fields: [userId], references: [id])
|
||||
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id
|
||||
name String
|
||||
email String @unique
|
||||
role String
|
||||
Account Account[]
|
||||
Session Session[]
|
||||
PrintJob PrintJob[]
|
||||
id String @id @default(cuid())
|
||||
name String?
|
||||
email String? @unique
|
||||
role Int @default(0) // 0: Guest, 1: User, 2: Admin
|
||||
emailVerified DateTime?
|
||||
image String?
|
||||
accounts Account[]
|
||||
sessions Session[]
|
||||
PrintJob PrintJob[]
|
||||
}
|
||||
|
||||
model VerificationToken {
|
||||
identifier String
|
||||
token String @unique
|
||||
expires DateTime
|
||||
|
||||
@@unique([identifier, token])
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user