86 lines
4.1 KiB
Python
86 lines
4.1 KiB
Python
# Generated by Django 5.2.5 on 2025-02-24 00:00
|
|
|
|
import django.db.models.deletion
|
|
import uuid
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
initial = True
|
|
|
|
dependencies = [
|
|
("farm_hub", "0009_farmhub_irrigation_method_fields"),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name="FarmerTodoZone",
|
|
fields=[
|
|
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
|
("uuid", models.UUIDField(db_index=True, default=uuid.uuid4, editable=False, unique=True)),
|
|
("label", models.CharField(max_length=255)),
|
|
("value", models.CharField(max_length=255)),
|
|
("is_active", models.BooleanField(default=True)),
|
|
("created_at", models.DateTimeField(auto_now_add=True)),
|
|
("updated_at", models.DateTimeField(auto_now=True)),
|
|
(
|
|
"farm",
|
|
models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name="todo_zones", to="farm_hub.farmhub"),
|
|
),
|
|
],
|
|
options={"db_table": "farmer_todo_zones", "ordering": ["label"]},
|
|
),
|
|
migrations.CreateModel(
|
|
name="FarmerTodoTag",
|
|
fields=[
|
|
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
|
("uuid", models.UUIDField(db_index=True, default=uuid.uuid4, editable=False, unique=True)),
|
|
("label", models.CharField(max_length=100)),
|
|
("value", models.CharField(max_length=100)),
|
|
("is_active", models.BooleanField(default=True)),
|
|
("created_at", models.DateTimeField(auto_now_add=True)),
|
|
("updated_at", models.DateTimeField(auto_now=True)),
|
|
(
|
|
"farm",
|
|
models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name="todo_tags", to="farm_hub.farmhub"),
|
|
),
|
|
],
|
|
options={"db_table": "farmer_todo_tags", "ordering": ["label"]},
|
|
),
|
|
migrations.CreateModel(
|
|
name="FarmerTodoTask",
|
|
fields=[
|
|
("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")),
|
|
("title", models.CharField(max_length=255)),
|
|
("scheduled_date", models.DateField()),
|
|
("time", models.TimeField()),
|
|
("priority", models.CharField(choices=[("زیاد", "High"), ("متوسط", "Medium"), ("کم", "Low")], max_length=16)),
|
|
("note", models.TextField(blank=True, default="")),
|
|
("status", models.CharField(choices=[("open", "Open"), ("done", "Done")], default="open", max_length=16)),
|
|
("created_at", models.DateTimeField(auto_now_add=True)),
|
|
("updated_at", models.DateTimeField(auto_now=True)),
|
|
(
|
|
"farm",
|
|
models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name="todo_tasks", to="farm_hub.farmhub"),
|
|
),
|
|
(
|
|
"tags",
|
|
models.ManyToManyField(blank=True, related_name="tasks", to="farmer_todos.farmertodotag"),
|
|
),
|
|
(
|
|
"zone",
|
|
models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name="tasks", to="farmer_todos.farmertodozone"),
|
|
),
|
|
],
|
|
options={"db_table": "farmer_todo_tasks", "ordering": ["scheduled_date", "time", "created_at"]},
|
|
),
|
|
migrations.AddConstraint(
|
|
model_name="farmertodozone",
|
|
constraint=models.UniqueConstraint(fields=("farm", "value"), name="uniq_farmer_todo_zone_per_farm"),
|
|
),
|
|
migrations.AddConstraint(
|
|
model_name="farmertodotag",
|
|
constraint=models.UniqueConstraint(fields=("farm", "value"), name="uniq_farmer_todo_tag_per_farm"),
|
|
),
|
|
]
|