# Generated by Django 4.1.2 on 2022-11-30 14:16

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


class Migration(migrations.Migration):

    dependencies = [
        ('recuperateur_reseau_viaire', '0019_auto_20221115_0903'),
    ]

    operations = [
        migrations.CreateModel(
            name='Ville',
            fields=[
                ('ville_nom', models.CharField(max_length=100, unique=True)),
                ('ville', models.IntegerField(primary_key=True, serialize=False)),
            ],
        ),
        migrations.RemoveField(
            model_name='graph_viaire_ville_information',
            name='gvvi_nom',
        ),
        migrations.CreateModel(
            name='Rassemblement_ville',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ville', models.ForeignKey(db_column='autre_id', on_delete=django.db.models.deletion.CASCADE, related_name='ville_id_rassemblement', related_query_name='%(app_label)s_%(class)ss', to='recuperateur_reseau_viaire.ville')),
                ('ville_englobante', models.ForeignKey(db_column='un_id', on_delete=django.db.models.deletion.CASCADE, related_name='id_ville_englobante', related_query_name='%(app_label)s_%(class)ss', to='recuperateur_reseau_viaire.ville')),
            ],
        ),
        migrations.AddField(
            model_name='graph_viaire_ville_information',
            name='ville',
            field=models.OneToOneField(default=1, on_delete=django.db.models.deletion.CASCADE, to='recuperateur_reseau_viaire.ville'),
            preserve_default=False,
        ),
        migrations.AddConstraint(
            model_name='rassemblement_ville',
            constraint=models.CheckConstraint(check=models.Q(('ville_englobante', models.F('ville')), _negated=True), name='ville_englobante_ne_peut-senglober'),
        ),
        migrations.AlterUniqueTogether(
            name='rassemblement_ville',
            unique_together={('ville_englobante', 'ville')},
        ),
    ]
