# Generated by Django 6.1.1 on 2026-09-23 from django.db import migrations, models def purge_completed_uploads(apps, schema_editor): """Completed staged uploads are notifications, not records. The board used to keep every auto-uploaded/indexed row until it was dismissed by hand, so they accumulated without bound (and bulk dismissal is capped at 1000 ids). Completions now live in a small per-run feed, so the old rows are removed here. """ TempUpload = apps.get_model("library", "TempUpload") for temp in TempUpload.objects.filter(status="completed").iterator(): if temp.file: temp.file.delete(save=False) temp.delete() class Migration(migrations.Migration): dependencies = [ ("library", "0011_upload_pipeline"), ] operations = [ migrations.AddField( model_name="uploadrun", name="recent_completions", field=models.JSONField(blank=True, default=list), ), migrations.RunPython(purge_completed_uploads, migrations.RunPython.noop), ]