# Generated by Django 4.2.5 on 2023-10-04 10:07

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


class Migration(migrations.Migration):

    dependencies = [
        ('virtualization', '0036_virtualmachine_config_template'),
        ('netbox_slm', '0006_softwarelicense_stored_location_url'),
    ]

    operations = [
        migrations.AddField(
            model_name='softwareproductinstallation',
            name='cluster',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='virtualization.cluster'),
        ),
        migrations.AlterField(
            model_name='softwarelicense',
            name='installation',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='netbox_slm.softwareproductinstallation'),
        ),
        migrations.AddConstraint(
            model_name='softwareproductinstallation',
            constraint=models.CheckConstraint(check=models.Q(models.Q(('cluster__isnull', True), ('device__isnull', False), ('virtualmachine__isnull', True)), models.Q(('cluster__isnull', True), ('device__isnull', True), ('virtualmachine__isnull', False)), models.Q(('cluster__isnull', False), ('device__isnull', True), ('virtualmachine__isnull', True)), _connector='OR'), name='netbox_slm_softwareproductinstallation_platform', violation_error_message='Installation requires exactly one platform destination.'),
        ),
    ]
