# Generated by Django 4.2.6 on 2023-10-10 20:06

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('accrete', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.AddField(
            model_name='member',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='memberships', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='accessgroupmember',
            name='access_group',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='accrete.accessgroup'),
        ),
        migrations.AddField(
            model_name='accessgroupmember',
            name='member',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='accrete.member'),
        ),
        migrations.AddConstraint(
            model_name='accessgroup',
            constraint=models.UniqueConstraint(fields=('code',), name='unique_code'),
        ),
        migrations.AddConstraint(
            model_name='tenantaccessgroup',
            constraint=models.UniqueConstraint(fields=('tenant', 'access_group'), name='unique_tenant_per_group'),
        ),
        migrations.AddConstraint(
            model_name='accessgroupmember',
            constraint=models.UniqueConstraint(fields=('member', 'access_group'), name='unique_member_per_group'),
        ),
    ]
