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/libs/prisma-clients/user-data/prisma/schema.prisma

58 lines
1.9 KiB

// 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"
output = "../../../../node_modules/.prisma/user-data-client"
}
datasource db {
provider = "postgresql"
url = env("USER_DATA_SOURCE_URL")
}
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)
}