# Generated by Django 5.2.7 on 2025-11-11 04:05

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


class Migration(migrations.Migration):

    dependencies = [
        ('stateflow', '0005_alter_state_description_and_more'),
    ]

    operations = [
        migrations.RemoveField(
            model_name='process',
            name='state_nodes',
        ),
        migrations.CreateModel(
            name='ProcessNode',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('updated_at', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
                ('order', models.PositiveIntegerField(default=0, verbose_name='顺序')),
                ('process', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='process_nodes', to='stateflow.process', verbose_name='流程')),
                ('state', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='state_process_nodes', to='stateflow.state', verbose_name='节点')),
            ],
            options={
                'verbose_name': '流程节点关联',
                'verbose_name_plural': '流程节点关联',
                'ordering': ['order', 'id'],
                'unique_together': {('process', 'order')},
            },
        ),
        migrations.AddField(
            model_name='process',
            name='state_nodes',
            field=models.ManyToManyField(related_name='processes', through='stateflow.ProcessNode', to='stateflow.state', verbose_name='节点列表'),
        ),
    ]
