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:
@@ -82,6 +82,13 @@ class BackupRun(models.Model):
|
||||
started_at = models.DateTimeField(null=True, blank=True)
|
||||
ended_at = models.DateTimeField(null=True, blank=True)
|
||||
snapshot_path = models.CharField(max_length=1024, blank=True)
|
||||
snapshot = models.ForeignKey(
|
||||
"SnapshotRecord",
|
||||
on_delete=models.SET_NULL,
|
||||
null=True,
|
||||
blank=True,
|
||||
related_name="backup_runs",
|
||||
)
|
||||
base_path = models.CharField(max_length=1024, blank=True)
|
||||
rsync_exit_code = models.IntegerField(null=True, blank=True)
|
||||
result = models.JSONField(default=dict, blank=True)
|
||||
|
||||
Reference in New Issue
Block a user