auth/prisma/schema.prisma

40 lines
924 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"
binaryTargets = ["linux-musl", "debian-openssl-3.0.x", "linux-musl-openssl-3.0.x"]
}
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
}