88 lines
2.5 KiB
Plaintext
88 lines
2.5 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 = "../generated/prisma"
|
||
}
|
||
|
||
datasource db {
|
||
provider = "mysql"
|
||
}
|
||
|
||
model User {
|
||
id Int @id @default(autoincrement())
|
||
name String
|
||
email String @unique
|
||
password String
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
}
|
||
|
||
model Article {
|
||
id Int @id @default(autoincrement())
|
||
title String
|
||
slug String @unique
|
||
content String
|
||
date String
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
}
|
||
|
||
model Strategy {
|
||
id Int @id @default(autoincrement())
|
||
name String
|
||
description String
|
||
data Json
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
}
|
||
|
||
model Indicator {
|
||
id Int @id @default(autoincrement())
|
||
name String @unique
|
||
groupName String
|
||
title String @default("")
|
||
unit String @default("")
|
||
source String @default("")
|
||
frequency String @default("month") // year | quarter | month | day
|
||
hidden Boolean @default(false) // true = 数据/脚本保留, 但不在前端展示
|
||
points IndicatorPoint[]
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
}
|
||
|
||
model IndicatorPoint {
|
||
id Int @id @default(autoincrement())
|
||
indicatorId Int
|
||
indicator Indicator @relation(fields: [indicatorId], references: [id], onDelete: Cascade)
|
||
period String // "2024" | "2024-Q1" | "2024-01" | "2024-01-15"
|
||
value Float
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
|
||
@@unique([indicatorId, period])
|
||
}
|
||
|
||
model Econ_SowInventory {
|
||
id Int @id @default(autoincrement())
|
||
month String @unique
|
||
inventory Int // 能繁母猪数量(万头)
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
}
|
||
|
||
model ScraperCache {
|
||
id Int @id @default(autoincrement())
|
||
scraperName String @unique // 爬虫名称,如:sow-inventory
|
||
lastDataHash String? // 上次数据指纹
|
||
lastUpdateAt DateTime // 上次更新时间
|
||
metadata Json? // 其他元数据
|
||
createdAt DateTime @default(now())
|
||
updatedAt DateTime @updatedAt
|
||
}
|
||
|
||
|