update
This commit is contained in:
103
prisma/schema.prisma
Normal file
103
prisma/schema.prisma
Normal file
@@ -0,0 +1,103 @@
|
||||
// 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"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
model Project {
|
||||
id Int @id @default(autoincrement())
|
||||
title String @db.VarChar(255)
|
||||
description String @db.Text
|
||||
content String @db.Text
|
||||
tags String[] @default([])
|
||||
featured Boolean @default(false)
|
||||
category String @db.VarChar(100)
|
||||
date String @db.VarChar(10)
|
||||
github String? @db.VarChar(500)
|
||||
live String? @db.VarChar(500)
|
||||
published Boolean @default(true)
|
||||
imageUrl String? @db.VarChar(500)
|
||||
metaDescription String? @db.Text
|
||||
keywords String? @db.Text
|
||||
ogImage String? @db.VarChar(500)
|
||||
schema Json?
|
||||
|
||||
// Advanced features
|
||||
difficulty Difficulty @default(INTERMEDIATE)
|
||||
timeToComplete String? @db.VarChar(100)
|
||||
technologies String[] @default([])
|
||||
challenges String[] @default([])
|
||||
lessonsLearned String[] @default([])
|
||||
futureImprovements String[] @default([])
|
||||
demoVideo String? @db.VarChar(500)
|
||||
screenshots String[] @default([])
|
||||
colorScheme String @db.VarChar(100) @default("Dark")
|
||||
accessibility Boolean @default(true)
|
||||
|
||||
// Performance metrics
|
||||
performance Json @default("{\"lighthouse\": 90, \"bundleSize\": \"50KB\", \"loadTime\": \"1.5s\"}")
|
||||
|
||||
// Analytics
|
||||
analytics Json @default("{\"views\": 0, \"likes\": 0, \"shares\": 0}")
|
||||
|
||||
// Timestamps
|
||||
createdAt DateTime @default(now()) @map("created_at")
|
||||
updatedAt DateTime @updatedAt @map("updated_at")
|
||||
|
||||
// Indexes for performance
|
||||
@@index([category])
|
||||
@@index([featured])
|
||||
@@index([published])
|
||||
@@index([difficulty])
|
||||
@@index([createdAt])
|
||||
@@index([tags])
|
||||
}
|
||||
|
||||
enum Difficulty {
|
||||
BEGINNER
|
||||
INTERMEDIATE
|
||||
ADVANCED
|
||||
EXPERT
|
||||
}
|
||||
|
||||
// Analytics tracking
|
||||
model PageView {
|
||||
id Int @id @default(autoincrement())
|
||||
projectId Int? @map("project_id")
|
||||
page String @db.VarChar(100)
|
||||
ip String? @db.VarChar(45)
|
||||
userAgent String? @db.Text @map("user_agent")
|
||||
referrer String? @db.VarChar(500)
|
||||
timestamp DateTime @default(now())
|
||||
|
||||
@@index([projectId])
|
||||
@@index([timestamp])
|
||||
@@index([page])
|
||||
}
|
||||
|
||||
// User interactions
|
||||
model UserInteraction {
|
||||
id Int @id @default(autoincrement())
|
||||
projectId Int @map("project_id")
|
||||
type InteractionType
|
||||
ip String? @db.VarChar(45)
|
||||
userAgent String? @db.Text @map("user_agent")
|
||||
timestamp DateTime @default(now())
|
||||
|
||||
@@index([projectId])
|
||||
@@index([type])
|
||||
@@index([timestamp])
|
||||
}
|
||||
|
||||
enum InteractionType {
|
||||
LIKE
|
||||
SHARE
|
||||
BOOKMARK
|
||||
COMMENT
|
||||
}
|
||||
Reference in New Issue
Block a user