first commit

This commit is contained in:
2026-03-19 22:54:29 +03:30
parent 1a178f39b7
commit 035bc6f74d
91 changed files with 3821 additions and 130 deletions
+34
View File
@@ -0,0 +1,34 @@
# Generated manually for location_data
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = []
operations = [
migrations.CreateModel(
name="SoilLocation",
fields=[
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
("latitude", models.DecimalField(db_index=True, decimal_places=6, help_text="عرض جغرافیایی (lat)", max_digits=9)),
("longitude", models.DecimalField(db_index=True, decimal_places=6, help_text="طول جغرافیایی (lon)", max_digits=9)),
("depth_0_5cm", models.JSONField(blank=True, help_text="داده‌های لایه ۰–۵ سانتی‌متر از API SoilGrids", null=True)),
("depth_5_15cm", models.JSONField(blank=True, help_text="داده‌های لایه ۵–۱۵ سانتی‌متر از API SoilGrids", null=True)),
("depth_15_30cm", models.JSONField(blank=True, help_text="داده‌های لایه ۱۵–۳۰ سانتی‌متر از API SoilGrids", null=True)),
("task_id", models.CharField(blank=True, help_text="شناسه تسک Celery در حال پردازش", max_length=255)),
("created_at", models.DateTimeField(auto_now_add=True)),
("updated_at", models.DateTimeField(auto_now=True)),
],
options={
"ordering": ["-updated_at"],
},
),
migrations.AddConstraint(
model_name="soillocation",
constraint=models.UniqueConstraint(fields=("latitude", "longitude"), name="soil_location_unique_lat_lon"),
),
]
@@ -0,0 +1,77 @@
# Generated manually: refactor to SoilDepthData table
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("location_data", "0001_initial"),
]
operations = [
migrations.CreateModel(
name="SoilDepthData",
fields=[
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
(
"depth_label",
models.CharField(
choices=[
("0-5cm", "۰–۵ سانتی‌متر"),
("5-15cm", "۵–۱۵ سانتی‌متر"),
("15-30cm", "۱۵–۳۰ سانتی‌متر"),
],
db_index=True,
max_length=10,
),
),
("bdod", models.FloatField(blank=True, null=True)),
("cec", models.FloatField(blank=True, null=True)),
("cfvo", models.FloatField(blank=True, null=True)),
("clay", models.FloatField(blank=True, null=True)),
("nitrogen", models.FloatField(blank=True, null=True)),
("ocd", models.FloatField(blank=True, null=True)),
("ocs", models.FloatField(blank=True, null=True)),
("phh2o", models.FloatField(blank=True, null=True)),
("sand", models.FloatField(blank=True, null=True)),
("silt", models.FloatField(blank=True, null=True)),
("soc", models.FloatField(blank=True, null=True)),
("wv0010", models.FloatField(blank=True, null=True)),
("wv0033", models.FloatField(blank=True, null=True)),
("wv1500", models.FloatField(blank=True, null=True)),
("created_at", models.DateTimeField(auto_now_add=True)),
(
"soil_location",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="depths",
to="location_data.soillocation",
),
),
],
options={
"ordering": ["soil_location", "depth_label"],
},
),
migrations.AddConstraint(
model_name="soildepthdata",
constraint=models.UniqueConstraint(
fields=("soil_location", "depth_label"),
name="soil_depth_unique_location_depth",
),
),
migrations.RemoveField(
model_name="soillocation",
name="depth_0_5cm",
),
migrations.RemoveField(
model_name="soillocation",
name="depth_5_15cm",
),
migrations.RemoveField(
model_name="soillocation",
name="depth_15_30cm",
),
]
@@ -0,0 +1,17 @@
from django.db import migrations
from django.db import migrations
from django.db import migrations
class Migration(migrations.Migration):
"""
نشانگر تغییر اپ label از soil_data به location_data.
پیش از اجرای این migration، دستور زیر را اجرا کنید:
python manage.py rename_soil_data_label
"""
dependencies = [
("location_data", "0002_soildepthdata_refactor"),
]
operations = []