Files
Ai/location_data/migrations/0002_soildepthdata_refactor.py
T
2026-03-19 22:54:29 +03:30

78 lines
3.0 KiB
Python

# 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",
),
]