54 lines
1.1 KiB
Plaintext
54 lines
1.1 KiB
Plaintext
// This is your Prisma schema file,
|
|
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
|
|
// Get a free hosted Postgres database in seconds: `npx create-db`
|
|
|
|
generator client {
|
|
provider = "prisma-client"
|
|
output = "../src/generated/prisma"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
}
|
|
|
|
enum UserRole {
|
|
USER
|
|
ADMIN
|
|
}
|
|
|
|
model User {
|
|
id Int @id @default(autoincrement())
|
|
name String
|
|
email String @unique
|
|
password String
|
|
phone String? @unique
|
|
role UserRole @default(USER)
|
|
isActive Boolean @default(true)
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
addresses Address[]
|
|
|
|
@@map("users")
|
|
}
|
|
|
|
model Address {
|
|
id Int @id @default(autoincrement())
|
|
userId Int
|
|
label String
|
|
street String
|
|
neighborhood String?
|
|
postalCode String?
|
|
latitude Float?
|
|
longitude Float?
|
|
isDefault Boolean @default(false)
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
@@map("addresses")
|
|
} |