Files
Logic/Modules/Ai/location_data/migrations/0007_ndviobservation.py
T
2026-05-11 03:27:21 +03:30

47 lines
1.9 KiB
Python

from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("location_data", "0006_remove_soillocation_ideal_sensor_profile"),
]
operations = [
migrations.CreateModel(
name="NdviObservation",
fields=[
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
("observation_date", models.DateField(db_index=True)),
("mean_ndvi", models.FloatField()),
("ndvi_map", models.JSONField(blank=True, default=dict)),
("vegetation_health_class", models.CharField(max_length=64)),
("satellite_source", models.CharField(default="sentinel-2", max_length=64)),
("cloud_cover", models.FloatField(blank=True, null=True)),
("metadata", models.JSONField(blank=True, default=dict)),
("created_at", models.DateTimeField(auto_now_add=True, db_index=True)),
(
"location",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="ndvi_observations",
to="location_data.soillocation",
),
),
],
options={
"verbose_name": "NDVI Observation",
"verbose_name_plural": "NDVI Observations",
"db_table": "dashboard_data_ndviobservation",
"ordering": ["-observation_date", "-created_at"],
"constraints": [
models.UniqueConstraint(
fields=("location", "observation_date", "satellite_source"),
name="ndvi_unique_location_date_source",
),
],
},
),
]