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

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


class Migration(migrations.Migration):

    dependencies = [
        ('stateflow', '0008_remove_process_current_state_order'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.RemoveField(
            model_name='order',
            name='current_state',
        ),
        migrations.CreateModel(
            name='OrderStateLog',
            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='更新时间')),
                ('completed_at', models.DateTimeField(auto_now_add=True, verbose_name='完成时间')),
                ('notes', models.TextField(blank=True, verbose_name='备注')),
                ('completed_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='completed_order_states', to=settings.AUTH_USER_MODEL, verbose_name='完成人')),
                ('order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='state_logs', to='stateflow.order', verbose_name='订单')),
                ('state', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='order_logs', to='stateflow.state', verbose_name='状态节点')),
            ],
            options={
                'verbose_name': '订单状态日志',
                'verbose_name_plural': '订单状态日志',
                'ordering': ['completed_at'],
                'unique_together': {('order', 'state')},
            },
        ),
    ]
