# Generated by Django 5.2.17 on 2026-09-15 09:28 import django.db.models.deletion import uuid from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ('rbac', '__first__'), ] operations = [ migrations.CreateModel( name='Workflow', fields=[ ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), ('created_at', models.DateTimeField(auto_now_add=True, db_index=True)), ('updated_at', models.DateTimeField(auto_now=True)), ('name', models.CharField(max_length=200)), ('slug', models.SlugField(max_length=200, unique=True)), ('description', models.TextField(blank=True)), ('status', models.CharField(choices=[('draft', 'Draft'), ('active', 'Active'), ('inactive', 'Inactive'), ('archived', 'Archived')], default='draft', max_length=16)), ], options={ 'abstract': False, }, ), migrations.CreateModel( name='WorkflowStep', fields=[ ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), ('key', models.SlugField(max_length=100)), ('name', models.CharField(max_length=200)), ('description', models.TextField(blank=True)), ('order', models.PositiveIntegerField(default=0)), ('step_type', models.CharField(choices=[('task', 'Task'), ('decision', 'Decision'), ('input', 'Input'), ('output', 'Output'), ('integration', 'Integration')], default='task', max_length=16)), ('required', models.BooleanField(default=False)), ('enabled', models.BooleanField(default=True)), ('estimated_duration_minutes', models.PositiveIntegerField(default=0)), ('is_start', models.BooleanField(default=False)), ('is_terminal', models.BooleanField(default=False)), ('requires_customer_confirmation', models.BooleanField(default=False)), ('requires_payment', models.BooleanField(default=False)), ('triggers_invoice', models.BooleanField(default=False)), ('triggers_odoo_sync', models.BooleanField(default=False)), ('customer_visible', models.BooleanField(default=True)), ('operator_visible', models.BooleanField(default=True)), ('live_monitoring_enabled', models.BooleanField(default=False)), ('input_schema', models.JSONField(blank=True, default=dict)), ('output_schema', models.JSONField(blank=True, default=dict)), ('availability_condition', models.JSONField(blank=True, default=dict)), ], options={ 'ordering': ['order'], }, ), migrations.CreateModel( name='WorkflowVersion', fields=[ ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), ('created_at', models.DateTimeField(auto_now_add=True, db_index=True)), ('updated_at', models.DateTimeField(auto_now=True)), ('version', models.PositiveIntegerField()), ('status', models.CharField(choices=[('draft', 'Draft'), ('active', 'Active'), ('inactive', 'Inactive'), ('archived', 'Archived')], default='draft', max_length=16)), ('published_at', models.DateTimeField(blank=True, null=True)), ('workflow', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='versions', to='workflows.workflow')), ], options={ 'ordering': ['-version'], }, ), migrations.CreateModel( name='WorkflowTransition', fields=[ ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), ('conditions', models.JSONField(blank=True, default=list)), ('from_step', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='outgoing', to='workflows.workflowstep')), ('required_roles', models.ManyToManyField(blank=True, to='rbac.role')), ('to_step', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='incoming', to='workflows.workflowstep')), ('version', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='transitions', to='workflows.workflowversion')), ], ), migrations.AddField( model_name='workflowstep', name='version', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='steps', to='workflows.workflowversion'), ), migrations.AddField( model_name='workflow', name='active_version', field=models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='workflows.workflowversion'), ), migrations.AddConstraint( model_name='workflowversion', constraint=models.UniqueConstraint(fields=('workflow', 'version'), name='uniq_workflow_version'), ), migrations.AddConstraint( model_name='workflowtransition', constraint=models.UniqueConstraint(fields=('version', 'from_step', 'to_step'), name='uniq_transition'), ), migrations.AddConstraint( model_name='workflowstep', constraint=models.UniqueConstraint(fields=('version', 'key'), name='uniq_step_key'), ), ]