# Generated by Django 5.0 on 2026-02-15 02:45

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('fields', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Crop',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100, unique=True, verbose_name='作物名')),
            ],
            options={
                'verbose_name': '作物マスタ',
                'verbose_name_plural': '作物マスタ',
            },
        ),
        migrations.CreateModel(
            name='Variety',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=100, verbose_name='品種名')),
                ('crop', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='varieties', to='plans.crop', verbose_name='作物')),
            ],
            options={
                'verbose_name': '品種マスタ',
                'verbose_name_plural': '品種マスタ',
                'unique_together': {('crop', 'name')},
            },
        ),
        migrations.CreateModel(
            name='Plan',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('year', models.IntegerField(verbose_name='作付年度')),
                ('notes', models.TextField(blank=True, null=True, verbose_name='備考')),
                ('crop', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='plans', to='plans.crop', verbose_name='作物')),
                ('field', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='plans', to='fields.field', verbose_name='圃場')),
                ('variety', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='plans', to='plans.variety', verbose_name='品種')),
            ],
            options={
                'verbose_name': '作付け計画',
                'verbose_name_plural': '作付け計画',
                'ordering': ['-year', 'field'],
                'unique_together': {('field', 'year')},
            },
        ),
    ]
