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


class Migration(migrations.Migration):

    dependencies = [
        ('fields', '0006_e1c_chusankan_17_fields'),
        ('plans', '0009_alter_ricetransplantentry_installed_seedling_boxes'),
    ]

    operations = [
        migrations.CreateModel(
            name='PlanVarietyChange',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('year', models.IntegerField(verbose_name='作付年度')),
                ('changed_at', models.DateTimeField(auto_now_add=True, verbose_name='変更日時')),
                ('reason', models.TextField(blank=True, default='', verbose_name='変更理由')),
                ('fertilizer_moved_entry_count', models.IntegerField(default=0, verbose_name='施肥移動エントリ数')),
                ('field', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='plan_variety_changes', to='fields.field', verbose_name='圃場')),
                ('new_variety', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='new_plan_variety_changes', to='plans.variety', verbose_name='変更後品種')),
                ('old_variety', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='old_plan_variety_changes', to='plans.variety', verbose_name='変更前品種')),
                ('plan', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='variety_changes', to='plans.plan', verbose_name='作付け計画')),
            ],
            options={
                'verbose_name': '作付け計画品種変更履歴',
                'verbose_name_plural': '作付け計画品種変更履歴',
                'ordering': ['-changed_at', '-id'],
            },
        ),
    ]
