openforce/workflows/migrations/0001_initial.py
2026-09-26 07:31:43 +00:00

55 lines
2.8 KiB
Python

# Generated by Django 4.2.30 on 2026-09-26 07:25
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='FlowDefinition',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
('description', models.TextField(blank=True, default='')),
('trigger_type', models.CharField(choices=[('record_created', 'Record Created'), ('record_updated', 'Record Updated'), ('scheduled', 'Scheduled'), ('manual', 'Manual / API Trigger')], default='manual', max_length=50)),
('is_active', models.BooleanField(default=True)),
('graph', models.JSONField(default=dict, help_text='Vue Flow DAG graph structure with nodes and edges')),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
],
options={
'ordering': ['-created_at'],
},
),
migrations.CreateModel(
name='FlowExecutionLog',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('status', models.CharField(choices=[('pending', 'Pending'), ('running', 'Running'), ('completed', 'Completed'), ('failed', 'Failed')], default='pending', max_length=20)),
('started_at', models.DateTimeField(auto_now_add=True)),
('completed_at', models.DateTimeField(blank=True, null=True)),
('steps_executed', models.JSONField(default=list)),
('context_data', models.JSONField(default=dict)),
('error_message', models.TextField(blank=True, default='')),
('idempotency_key', models.CharField(blank=True, db_index=True, max_length=255, null=True)),
('flow', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='executions', to='workflows.flowdefinition')),
],
options={
'ordering': ['-started_at'],
},
),
migrations.AddConstraint(
model_name='flowexecutionlog',
constraint=models.UniqueConstraint(condition=models.Q(('idempotency_key__isnull', False)), fields=('idempotency_key',), name='unique_idempotency_key_when_not_null'),
),
]