add docker and prisma
This commit is contained in:
54
backend/prisma/schema.prisma
Normal file
54
backend/prisma/schema.prisma
Normal file
@@ -0,0 +1,54 @@
|
||||
// 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")
|
||||
}
|
||||
Reference in New Issue
Block a user