UPDATE
This commit is contained in:
@@ -0,0 +1,184 @@
|
||||
# Generated manually for weather
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
("location_data", "0002_soildepthdata_refactor"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
# ── WeatherParameter ──
|
||||
migrations.CreateModel(
|
||||
name="WeatherParameter",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
(
|
||||
"code",
|
||||
models.CharField(
|
||||
db_index=True,
|
||||
help_text="کد یکتا (مثلاً temperature_max)",
|
||||
max_length=64,
|
||||
unique=True,
|
||||
),
|
||||
),
|
||||
(
|
||||
"name_fa",
|
||||
models.CharField(
|
||||
help_text="نام فارسی",
|
||||
max_length=128,
|
||||
),
|
||||
),
|
||||
(
|
||||
"unit",
|
||||
models.CharField(
|
||||
blank=True,
|
||||
help_text="واحد اندازهگیری",
|
||||
max_length=32,
|
||||
),
|
||||
),
|
||||
("created_at", models.DateTimeField(auto_now_add=True)),
|
||||
],
|
||||
options={
|
||||
"ordering": ["code"],
|
||||
"verbose_name": "پارامتر هواشناسی",
|
||||
"verbose_name_plural": "پارامترهای هواشناسی",
|
||||
},
|
||||
),
|
||||
# ── WeatherForecast ──
|
||||
migrations.CreateModel(
|
||||
name="WeatherForecast",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
(
|
||||
"location",
|
||||
models.ForeignKey(
|
||||
help_text="موقعیت مکانی مرتبط از جدول SoilLocation",
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="weather_forecasts",
|
||||
to="location_data.soillocation",
|
||||
),
|
||||
),
|
||||
(
|
||||
"forecast_date",
|
||||
models.DateField(
|
||||
db_index=True,
|
||||
help_text="تاریخ پیشبینی",
|
||||
),
|
||||
),
|
||||
(
|
||||
"temperature_min",
|
||||
models.FloatField(
|
||||
blank=True,
|
||||
help_text="حداقل دمای هوا (°C)",
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
(
|
||||
"temperature_max",
|
||||
models.FloatField(
|
||||
blank=True,
|
||||
help_text="حداکثر دمای هوا (°C)",
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
(
|
||||
"temperature_mean",
|
||||
models.FloatField(
|
||||
blank=True,
|
||||
help_text="میانگین دمای هوا (°C)",
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
(
|
||||
"precipitation",
|
||||
models.FloatField(
|
||||
blank=True,
|
||||
help_text="مجموع بارش (mm)",
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
(
|
||||
"precipitation_probability",
|
||||
models.FloatField(
|
||||
blank=True,
|
||||
help_text="احتمال بارش (%)",
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
(
|
||||
"humidity_mean",
|
||||
models.FloatField(
|
||||
blank=True,
|
||||
help_text="میانگین رطوبت نسبی (%)",
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
(
|
||||
"wind_speed_max",
|
||||
models.FloatField(
|
||||
blank=True,
|
||||
help_text="حداکثر سرعت باد (km/h)",
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
(
|
||||
"et0",
|
||||
models.FloatField(
|
||||
blank=True,
|
||||
help_text="تبخیر-تعرق مرجع (ET₀) — mm/day",
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
(
|
||||
"weather_code",
|
||||
models.IntegerField(
|
||||
blank=True,
|
||||
help_text="کد وضعیت آبوهوا (WMO code)",
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
(
|
||||
"fetched_at",
|
||||
models.DateTimeField(
|
||||
auto_now=True,
|
||||
help_text="آخرین زمان واکشی از API",
|
||||
),
|
||||
),
|
||||
("created_at", models.DateTimeField(auto_now_add=True)),
|
||||
],
|
||||
options={
|
||||
"ordering": ["location", "forecast_date"],
|
||||
"verbose_name": "پیشبینی هواشناسی",
|
||||
"verbose_name_plural": "پیشبینیهای هواشناسی",
|
||||
},
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name="weatherforecast",
|
||||
constraint=models.UniqueConstraint(
|
||||
fields=("location", "forecast_date"),
|
||||
name="weather_unique_location_date",
|
||||
),
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user