108 lines
3.2 KiB
Plaintext
108 lines
3.2 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")
|
|
}
|
|
|
|
model GeopoliticalEvent {
|
|
id String @id @default(uuid()) @db.Uuid
|
|
title String
|
|
description String
|
|
category String
|
|
severity String
|
|
timestamp DateTime @db.Timestamptz
|
|
sourceUrl String? @map("source_url")
|
|
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz
|
|
|
|
@@index([timestamp])
|
|
@@index([category])
|
|
@@map("geopolitical_events")
|
|
}
|
|
|
|
model PowerPlant {
|
|
id String @id @default(uuid()) @db.Uuid
|
|
plantCode Int @unique @map("plant_code")
|
|
name String
|
|
operator String
|
|
location Unsupported("geography(Point, 4326)")
|
|
capacityMw Float @map("capacity_mw")
|
|
fuelType String @map("fuel_type")
|
|
state String
|
|
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz
|
|
|
|
@@map("power_plants")
|
|
}
|