37 lines
1.6 KiB
Python
37 lines
1.6 KiB
Python
from django.db import migrations, models
|
|
import django.db.models.deletion
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
("location_data", "0004_soillocation_farm_boundary"),
|
|
("dashboard_data", "0001_initial"),
|
|
]
|
|
|
|
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={
|
|
"ordering": ["-observation_date", "-created_at"],
|
|
"verbose_name": "NDVI Observation",
|
|
"verbose_name_plural": "NDVI Observations",
|
|
"constraints": [
|
|
models.UniqueConstraint(fields=("location", "observation_date", "satellite_source"), name="ndvi_unique_location_date_source"),
|
|
],
|
|
},
|
|
),
|
|
]
|