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.
25 lines
637 B
Python
25 lines
637 B
Python
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",
|
|
),
|
|
),
|
|
]
|