You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kubsu-platform-crud-2023/apps/user-data/prisma/schema.prisma

54 lines
1.7 KiB

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
}
model User {
uuid String @id @default(uuid()) @db.Uuid
email Email? @relation("mainEmail")
phoneNumber PhoneNumber? @relation("mainPhoneNumber")
reserveEmails Email[] @relation("reserveEmails")
reservePhoneNumbers PhoneNumber[] @relation("reservePhoneNumbers")
extendedData Json @default("{}") @db.JsonB
createdAt DateTime @db.Timestamp(3)
updatedAt DateTime @db.Timestamp(3)
}
model Email {
uuid String @id @default(uuid()) @db.Uuid
email String @unique @db.VarChar(256)
userUuid String? @unique @db.Uuid
user User? @relation("mainEmail", fields: [userUuid], references: [uuid])
userUuidReserve String? @db.Uuid
userReserve User? @relation("reserveEmails", fields: [userUuidReserve], references: [uuid])
createdAt DateTime @db.Timestamp(3)
updatedAt DateTime @db.Timestamp(3)
}
model PhoneNumber {
uuid String @id @default(uuid()) @db.Uuid
phoneNumber String @unique @db.VarChar(20)
userUuid String? @unique @db.Uuid
user User? @relation("mainPhoneNumber", fields: [userUuid], references: [uuid])
userUuidReserve String? @db.Uuid
userReserve User? @relation("reservePhoneNumbers", fields: [userUuidReserve], references: [uuid])
createdAt DateTime @db.Timestamp(3)
updatedAt DateTime @db.Timestamp(3)
}