feat: link backup runs to snapshot records

Add a nullable SnapshotRecord foreign key to BackupRun and populate it
when run_pobsync_backup records a completed or failed snapshot. Keep the
existing snapshot_path for audit compatibility while making run-to-snapshot
navigation explicit in the database and admin.
This commit is contained in:
2026-05-19 11:13:06 +02:00
parent 0a49c5719c
commit 5808800981
5 changed files with 48 additions and 9 deletions

View File

@@ -0,0 +1,24 @@
from __future__ import annotations
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("pobsync_backend", "0003_structured_config_fields"),
]
operations = [
migrations.AddField(
model_name="backuprun",
name="snapshot",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="backup_runs",
to="pobsync_backend.snapshotrecord",
),
),
]