68 lines
2.9 KiB
Python
68 lines
2.9 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="FarmerCalendarTag",
|
||
|
|
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="calendar_tags", to="farm_hub.farmhub"),
|
||
|
|
),
|
||
|
|
],
|
||
|
|
options={
|
||
|
|
"db_table": "farmer_calendar_tags",
|
||
|
|
"ordering": ["label"],
|
||
|
|
},
|
||
|
|
),
|
||
|
|
migrations.CreateModel(
|
||
|
|
name="FarmerCalendarEvent",
|
||
|
|
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)),
|
||
|
|
("title", models.CharField(max_length=255)),
|
||
|
|
("description", models.TextField(blank=True, default="")),
|
||
|
|
("deadline", models.BigIntegerField(blank=True, null=True)),
|
||
|
|
("start", models.DateTimeField()),
|
||
|
|
("end", models.DateTimeField()),
|
||
|
|
("extended_props", models.JSONField(blank=True, default=dict)),
|
||
|
|
("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="calendar_events", to="farm_hub.farmhub"),
|
||
|
|
),
|
||
|
|
(
|
||
|
|
"tags",
|
||
|
|
models.ManyToManyField(blank=True, related_name="events", to="farmer_calendar.farmercalendartag"),
|
||
|
|
),
|
||
|
|
],
|
||
|
|
options={
|
||
|
|
"db_table": "farmer_calendar_events",
|
||
|
|
"ordering": ["start", "created_at"],
|
||
|
|
},
|
||
|
|
),
|
||
|
|
migrations.AddConstraint(
|
||
|
|
model_name="farmercalendartag",
|
||
|
|
constraint=models.UniqueConstraint(fields=("farm", "value"), name="uniq_farmer_calendar_tag_per_farm"),
|
||
|
|
),
|
||
|
|
]
|