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])
|
User User @relation(fields: [user_id], references: [id])
|
||||||
}
|
}
|
||||||
|
|
||||||
// NextAuth Schema
|
// Necessary for Next auth
|
||||||
model Account {
|
model Account {
|
||||||
id String @id @unique
|
id String @id @default(cuid())
|
||||||
userId String
|
userId String
|
||||||
type String
|
type String
|
||||||
provider String
|
provider String
|
||||||
providerAccountId String
|
providerAccountId String
|
||||||
refresh_token String
|
refresh_token String? // @db.Text
|
||||||
access_token String
|
access_token String? // @db.Text
|
||||||
expires_at Int
|
expires_at Int?
|
||||||
token_type String
|
token_type String?
|
||||||
scope String
|
scope String?
|
||||||
id_token String
|
id_token String? // @db.Text
|
||||||
session_state String
|
session_state String?
|
||||||
User User @relation(fields: [userId], references: [id])
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||||
|
|
||||||
|
@@unique([provider, providerAccountId])
|
||||||
}
|
}
|
||||||
|
|
||||||
model Session {
|
model Session {
|
||||||
id String @id @unique
|
id String @id @default(cuid())
|
||||||
sessionToken String @unique
|
sessionToken String @unique
|
||||||
userId String
|
userId String
|
||||||
expires DateTime
|
expires DateTime
|
||||||
User User @relation(fields: [userId], references: [id])
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
||||||
}
|
}
|
||||||
|
|
||||||
model User {
|
model User {
|
||||||
id String @id
|
id String @id @default(cuid())
|
||||||
name String
|
name String?
|
||||||
email String @unique
|
email String? @unique
|
||||||
role String
|
role Int @default(0) // 0: Guest, 1: User, 2: Admin
|
||||||
Account Account[]
|
emailVerified DateTime?
|
||||||
Session Session[]
|
image String?
|
||||||
PrintJob PrintJob[]
|
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