# Generated by Django 5.0.2 on 2026-05-23 10:11

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


class Migration(migrations.Migration):

    dependencies = [
        ('products', '0008_article_citation_count_label'),
    ]

    operations = [
        migrations.AddField(
            model_name='article',
            name='main_product',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='articles', to='products.mainproduct'),
        ),
        migrations.AlterField(
            model_name='article',
            name='sub_product',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='articles', to='products.subproduct'),
        ),
        migrations.AddConstraint(
            model_name='article',
            constraint=models.CheckConstraint(check=models.Q(models.Q(('main_product__isnull', True), ('sub_product__isnull', False)), models.Q(('main_product__isnull', False), ('sub_product__isnull', True)), _connector='OR'), name='article_exactly_one_parent'),
        ),
    ]
