- Replace $0 electricity prices with real EIA retail-sales data (IND sector) with demand-based hourly variation (0.8x-1.2x) - Add sparkline component and alerts feed to dashboard home - Add animated number transitions to hero metric cards - Fix ticker tape price direction (green/red arrows with % change) - Fix AI milestone annotation alignment on price charts - Fix SQL cartesian products in getDemandByRegion and getRegionPriceHeatmap using CTEs for independent aggregation - Add unique composite constraints to prevent duplicate data - Add bearer token auth to ingestion API routes - Add 30s fetch timeouts to EIA and FRED API clients - Add regionCode validation in server actions - Fix docker-compose: localhost-only port binding, correct volume path - Fix seed script to preserve ingested time-series data
79 lines
2.3 KiB
Plaintext
79 lines
2.3 KiB
Plaintext
generator client {
|
|
provider = "prisma-client"
|
|
output = "../src/generated/prisma"
|
|
previewFeatures = ["typedSql"]
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
}
|
|
|
|
model GridRegion {
|
|
id String @id @default(uuid()) @db.Uuid
|
|
name String
|
|
code String @unique
|
|
iso String
|
|
boundary Unsupported("geography(MultiPolygon, 4326)")
|
|
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz
|
|
datacenters Datacenter[]
|
|
electricityPrices ElectricityPrice[]
|
|
generationMixes GenerationMix[]
|
|
|
|
@@map("grid_regions")
|
|
}
|
|
|
|
model Datacenter {
|
|
id String @id @default(uuid()) @db.Uuid
|
|
name String
|
|
operator String
|
|
location Unsupported("geography(Point, 4326)")
|
|
capacityMw Float @map("capacity_mw")
|
|
status String
|
|
yearOpened Int @map("year_opened")
|
|
regionId String @map("region_id") @db.Uuid
|
|
region GridRegion @relation(fields: [regionId], references: [id])
|
|
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz
|
|
|
|
@@map("datacenters")
|
|
}
|
|
|
|
model ElectricityPrice {
|
|
id String @id @default(uuid()) @db.Uuid
|
|
regionId String @map("region_id") @db.Uuid
|
|
region GridRegion @relation(fields: [regionId], references: [id])
|
|
priceMwh Float @map("price_mwh")
|
|
demandMw Float @map("demand_mw")
|
|
timestamp DateTime @db.Timestamptz
|
|
source String
|
|
|
|
@@unique([regionId, timestamp])
|
|
@@index([regionId, timestamp])
|
|
@@map("electricity_prices")
|
|
}
|
|
|
|
model CommodityPrice {
|
|
id String @id @default(uuid()) @db.Uuid
|
|
commodity String
|
|
price Float
|
|
unit String
|
|
timestamp DateTime @db.Timestamptz
|
|
source String
|
|
|
|
@@unique([commodity, timestamp])
|
|
@@index([commodity, timestamp])
|
|
@@map("commodity_prices")
|
|
}
|
|
|
|
model GenerationMix {
|
|
id String @id @default(uuid()) @db.Uuid
|
|
regionId String @map("region_id") @db.Uuid
|
|
region GridRegion @relation(fields: [regionId], references: [id])
|
|
fuelType String @map("fuel_type")
|
|
generationMw Float @map("generation_mw")
|
|
timestamp DateTime @db.Timestamptz
|
|
|
|
@@unique([regionId, fuelType, timestamp])
|
|
@@index([regionId, timestamp])
|
|
@@map("generation_mix")
|
|
}
|