// Weather & Climate Domain // Contains weather data, forecasts, and climate tracking model WeatherData { id String @id @default(cuid()) farmId String? plotId String? latitude Float longitude Float date DateTime temperature Float? // celsius humidity Float? // percentage rainfall Float? // mm windSpeed Float? // km/h windDirection String? // N, NE, E, SE, S, SW, W, NW pressure Float? // hPa uvIndex Float? visibility Float? // km weatherCondition String? // sunny, cloudy, rainy, etc. dataSource String? // manual, weather_station, api createdAt DateTime @default(now()) updatedAt DateTime @updatedAt // Relations farm Farm? @relation(fields: [farmId], references: [id]) plot Plot? @relation(fields: [plotId], references: [id]) @@index([farmId, plotId]) @@index([latitude, longitude]) @@index([date]) @@index([weatherCondition]) @@index([dataSource]) @@index([temperature]) @@index([rainfall]) @@map("weather_data") } model WeatherForecast { id String @id @default(cuid()) farmId String? plotId String? latitude Float longitude Float forecastDate DateTime minTemperature Float? maxTemperature Float? humidity Float? rainfall Float? windSpeed Float? weatherCondition String? confidence Float? // percentage source String createdAt DateTime @default(now()) // Relations farm Farm? @relation(fields: [farmId], references: [id]) plot Plot? @relation(fields: [plotId], references: [id]) @@index([farmId, plotId]) @@index([latitude, longitude]) @@index([forecastDate]) @@index([weatherCondition]) @@index([source]) @@index([confidence]) @@map("weather_forecasts") }