# Generated by Django 4.1.2 on 2022-10-25 22:04

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


class Migration(migrations.Migration):

    dependencies = [
        ('tom_nonlocalizedevents', '0013_eventcandidate_healpix_and_more'),
    ]

    operations = [
        migrations.CreateModel(
            name='CredibleRegion',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('smallest_percent', models.IntegerField(default=100, help_text='Smallest percent credible region this candidate falls into for this localization.')),
            ],
        ),
        migrations.RemoveConstraint(
            model_name='eventcandidate',
            name='Unique Target/NonLocalizedEvent',
        ),
        migrations.AlterField(
            model_name='eventlocalization',
            name='nonlocalizedevent',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='localizations', to='tom_nonlocalizedevents.nonlocalizedevent'),
        ),
        migrations.AddConstraint(
            model_name='eventcandidate',
            constraint=models.UniqueConstraint(fields=('target', 'nonlocalizedevent'), name='unique_target_nonlocalizedevent'),
        ),
        migrations.AddField(
            model_name='credibleregion',
            name='candidate',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='credibleregions', to='tom_nonlocalizedevents.eventcandidate'),
        ),
        migrations.AddField(
            model_name='credibleregion',
            name='localization',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='credibleregions', to='tom_nonlocalizedevents.eventlocalization'),
        ),
        migrations.AddConstraint(
            model_name='credibleregion',
            constraint=models.UniqueConstraint(fields=('localization', 'candidate'), name='unique_localization_candidate'),
        ),
    ]
