124 lines
3.8 KiB
Plaintext
124 lines
3.8 KiB
Plaintext
// This is your Prisma schema file,
|
|
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
|
|
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
|
|
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
|
|
|
|
generator client {
|
|
provider = "prisma-client-js"
|
|
previewFeatures = ["postgresqlExtensions"]
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
directUrl = env("DIRECT_URL")
|
|
extensions = [pgcrypto]
|
|
}
|
|
|
|
model User {
|
|
id String @id @db.Uuid
|
|
email String @unique @db.VarChar(255)
|
|
email_verified Boolean @default(false)
|
|
password String? @db.VarChar(255)
|
|
first_name String? @db.VarChar(255)
|
|
last_name String? @db.VarChar(255)
|
|
avatar String? @db.VarChar(255)
|
|
role Role @default(user)
|
|
created_at DateTime @default(now())
|
|
updated_at DateTime @updatedAt
|
|
last_signed_in DateTime?
|
|
metadata Json?
|
|
|
|
profile Profile?
|
|
|
|
@@index([role])
|
|
@@map("users")
|
|
}
|
|
|
|
model Profile {
|
|
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
|
user_id String @unique @db.Uuid
|
|
bio String? @db.Text
|
|
phone String? @db.VarChar(20)
|
|
address String? @db.VarChar(255)
|
|
city String? @db.VarChar(100)
|
|
country String? @db.VarChar(100)
|
|
birth_date DateTime?
|
|
user User @relation(fields: [user_id], references: [id])
|
|
|
|
@@index([user_id])
|
|
@@map("profiles") // Maps to Supabase's 'profiles' table
|
|
}
|
|
|
|
model ContactMessages {
|
|
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
|
name String? @db.VarChar(255)
|
|
email String? @db.VarChar(255)
|
|
phone String? @db.VarChar(20)
|
|
message_type String? @db.VarChar(50)
|
|
message_type_label String? @db.VarChar(50)
|
|
message String? @db.Text
|
|
status StatusContactMessages @default(new)
|
|
created_at DateTime @default(dbgenerated("now()")) @db.Timestamptz(6)
|
|
updated_at DateTime @default(dbgenerated("now()")) @updatedAt @db.Timestamptz(6)
|
|
|
|
@@map("contact_messages") // Maps to Supabase's 'contact_messages' table
|
|
}
|
|
|
|
model NavItems {
|
|
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
|
title String @db.VarChar(255)
|
|
url String @db.VarChar(255)
|
|
slug String @db.VarChar(255)
|
|
icon String @db.VarChar(100)
|
|
is_active Boolean @default(false)
|
|
order_seq Int
|
|
created_at DateTime @default(dbgenerated("now()")) @db.Timestamptz(6)
|
|
updated_at DateTime @default(dbgenerated("now()")) @updatedAt @db.Timestamptz(6)
|
|
sub_items NavSubItems[]
|
|
created_by String? @db.Uuid
|
|
updated_by String? @db.Uuid
|
|
|
|
@@index([title])
|
|
@@index([is_active])
|
|
@@map("nav_items")
|
|
}
|
|
|
|
model NavSubItems {
|
|
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
|
|
title String @db.VarChar(255)
|
|
url String @db.VarChar(255)
|
|
slug String @db.VarChar(255)
|
|
icon String @db.VarChar(100)
|
|
is_active Boolean @default(false)
|
|
order_seq Int
|
|
nav_item_id String @db.Uuid
|
|
created_at DateTime @default(dbgenerated("now()")) @db.Timestamptz(6)
|
|
updated_at DateTime @default(dbgenerated("now()")) @updatedAt @db.Timestamptz(6)
|
|
created_by String? @db.Uuid
|
|
updated_by String? @db.Uuid
|
|
nav_item NavItems @relation(fields: [nav_item_id], references: [id], onDelete: Cascade)
|
|
|
|
@@index([nav_item_id])
|
|
@@index([title])
|
|
@@map("nav_sub_items")
|
|
}
|
|
|
|
enum Role {
|
|
admin
|
|
staff
|
|
user
|
|
|
|
@@map("roles")
|
|
}
|
|
|
|
enum StatusContactMessages {
|
|
new
|
|
read
|
|
replied
|
|
resolved
|
|
|
|
@@map("status_contact_messages")
|
|
}
|