85 lines
4.2 KiB
Python
85 lines
4.2 KiB
Python
# Generated by Django 5.2.12 on 2026-03-10 09:33
|
|
|
|
import django.db.models.deletion
|
|
from django.conf import settings
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
initial = True
|
|
|
|
dependencies = [
|
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='IngestionRun',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('provider_namespace', models.CharField(max_length=80)),
|
|
('job_type', models.CharField(choices=[('full_sync', 'Full Sync'), ('incremental', 'Incremental'), ('manual', 'Manual')], max_length=32)),
|
|
('status', models.CharField(choices=[('pending', 'Pending'), ('running', 'Running'), ('success', 'Success'), ('failed', 'Failed'), ('canceled', 'Canceled')], default='pending', max_length=24)),
|
|
('started_at', models.DateTimeField(blank=True, null=True)),
|
|
('finished_at', models.DateTimeField(blank=True, null=True)),
|
|
('records_processed', models.PositiveIntegerField(default=0)),
|
|
('records_created', models.PositiveIntegerField(default=0)),
|
|
('records_updated', models.PositiveIntegerField(default=0)),
|
|
('records_failed', models.PositiveIntegerField(default=0)),
|
|
('context', models.JSONField(blank=True, default=dict)),
|
|
('raw_payload', models.JSONField(blank=True, default=dict)),
|
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
|
('triggered_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='ingestion_runs', to=settings.AUTH_USER_MODEL)),
|
|
],
|
|
options={
|
|
'ordering': ['-created_at'],
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='IngestionError',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('provider_namespace', models.CharField(max_length=80)),
|
|
('entity_type', models.CharField(blank=True, max_length=80)),
|
|
('external_id', models.CharField(blank=True, max_length=160)),
|
|
('severity', models.CharField(choices=[('warning', 'Warning'), ('error', 'Error'), ('critical', 'Critical')], default='error', max_length=16)),
|
|
('message', models.TextField()),
|
|
('raw_payload', models.JSONField(blank=True, default=dict)),
|
|
('occurred_at', models.DateTimeField(auto_now_add=True)),
|
|
('ingestion_run', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='errors', to='ingestion.ingestionrun')),
|
|
],
|
|
options={
|
|
'ordering': ['-occurred_at'],
|
|
},
|
|
),
|
|
migrations.AddIndex(
|
|
model_name='ingestionrun',
|
|
index=models.Index(fields=['provider_namespace', 'status'], name='ingestion_i_provide_1145f9_idx'),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name='ingestionrun',
|
|
index=models.Index(fields=['provider_namespace', 'job_type'], name='ingestion_i_provide_2f19cd_idx'),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name='ingestionrun',
|
|
index=models.Index(fields=['started_at'], name='ingestion_i_started_525875_idx'),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name='ingestionrun',
|
|
index=models.Index(fields=['finished_at'], name='ingestion_i_finishe_128c60_idx'),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name='ingestionerror',
|
|
index=models.Index(fields=['ingestion_run', 'occurred_at'], name='ingestion_i_ingesti_c957d2_idx'),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name='ingestionerror',
|
|
index=models.Index(fields=['provider_namespace', 'entity_type', 'external_id'], name='ingestion_i_provide_d3f744_idx'),
|
|
),
|
|
migrations.AddIndex(
|
|
model_name='ingestionerror',
|
|
index=models.Index(fields=['severity'], name='ingestion_i_severit_9e9331_idx'),
|
|
),
|
|
]
|