# Generated by Django 5.2 on 2026-04-04

import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('fields', '0006_e1c_chusankan_17_fields'),
        ('plans', '0004_crop_base_temp'),
    ]

    operations = [
        migrations.CreateModel(
            name='LeveeWorkSession',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('year', models.IntegerField(verbose_name='年度')),
                ('date', models.DateField(verbose_name='畔塗日')),
                ('title', models.CharField(default='水稲畔塗', max_length=100, verbose_name='タイトル')),
                ('notes', models.TextField(blank=True, default='', verbose_name='備考')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
            ],
            options={
                'verbose_name': '畔塗記録',
                'verbose_name_plural': '畔塗記録',
                'ordering': ['-date', '-id'],
            },
        ),
        migrations.CreateModel(
            name='LeveeWorkSessionItem',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('crop_name_snapshot', models.CharField(max_length=100, verbose_name='作物名スナップショット')),
                ('variety_name_snapshot', models.CharField(blank=True, default='', max_length=100, verbose_name='品種名スナップショット')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('field', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='fields.field', verbose_name='圃場')),
                ('plan', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='plans.plan', verbose_name='作付け計画')),
                ('session', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='levee_work.leveeworksession', verbose_name='畔塗記録')),
            ],
            options={
                'verbose_name': '畔塗対象圃場',
                'verbose_name_plural': '畔塗対象圃場',
                'ordering': ['field__display_order', 'field__id'],
                'unique_together': {('session', 'field')},
            },
        ),
    ]

