39 lines
834 B
Plaintext
39 lines
834 B
Plaintext
// This is your Prisma schema file,
|
|
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
|
|
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
model Auth {
|
|
uuid String @id @default(uuid()) @db.Uuid
|
|
password String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
usernames Username[]
|
|
|
|
@@map("auth")
|
|
}
|
|
|
|
model Username {
|
|
username String @id
|
|
authUuid String @db.Uuid
|
|
type Type @default(EMAIL) // type is needed in case of username update
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
Auth Auth @relation(fields: [authUuid], references: [uuid], onDelete: Cascade)
|
|
|
|
@@unique([authUuid, type])
|
|
@@map("username")
|
|
}
|
|
|
|
enum Type {
|
|
EMAIL
|
|
PHONE
|
|
}
|