# Generated by Django 6.0.6 on 2026-08-04 22:09

from django.db import migrations, models


def mark_seeded_hockey_competitions(apps, schema_editor):
    """RBIHF/CEHL (0017's data migration) predate sport_type -- they're both ice
    hockey leagues (see events/competition/hockey.py), so backfill them rather
    than leaving them at the generic "other" default."""
    Competition = apps.get_model("events", "Competition")
    Competition.objects.filter(name__in=["RBIHF", "CEHL"]).update(sport_type="ice_hockey")


def noop(apps, schema_editor):
    pass


class Migration(migrations.Migration):

    dependencies = [
        ('events', '0018_alter_competition_options_competition_flag'),
    ]

    operations = [
        migrations.AddField(
            model_name='competition',
            name='sport_type',
            field=models.CharField(choices=[('ice_hockey', 'Ice hockey'), ('other', 'Other')], default='other', help_text='Which sport this competition is for.', max_length=20, verbose_name='sport'),
        ),
        migrations.RunPython(mark_seeded_hockey_competitions, noop),
    ]
