| | | 1 | | namespace ZhEaIsNsAaBn.DbSeeder; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// What rolling back would do, from a dry run (every step executed in a transaction that is then rolled back), so the c |
| | | 5 | | /// blockers are the real ones. Nothing is changed. |
| | | 6 | | /// </summary> |
| | | 7 | | public sealed class SeedRollbackPlan |
| | | 8 | | { |
| | | 9 | | /// <summary>The migrations that would be rolled back, newest first.</summary> |
| | | 10 | | public required IReadOnlyList<string> Migrations { get; init; } |
| | | 11 | | |
| | | 12 | | /// <summary>Rows per migration, table and operation.</summary> |
| | | 13 | | public required IReadOnlyList<SeedRollbackStep> Steps { get; init; } |
| | | 14 | | |
| | | 15 | | /// <summary>Rows of other tables that reference seed rows a real delete would remove. Not empty → the rollback fail |
| | | 16 | | public required IReadOnlyList<SeedBlocker> Blockers { get; init; } |
| | | 17 | | |
| | | 18 | | /// <summary>Warnings, e.g. <c>ChecksumMismatch</c> (<see cref="Severity.Low"/>).</summary> |
| | | 19 | | public required IReadOnlyList<Error> Warnings { get; init; } |
| | | 20 | | |
| | | 21 | | |
| | | 22 | | /// <summary> |
| | | 23 | | /// For a forced plan (design tools only): every dependent table a forced delete would empty first, bottom-up. Empty |
| | | 24 | | /// </summary> |
| | | 25 | | public IReadOnlyList<SeedForceNode> ForceTree { get; init; } = []; |
| | | 26 | | |
| | | 27 | | /// <summary>For a forced plan: why a forced delete is refused (cycle, self-reference, no primary key); <see langwor |
| | | 28 | | public string? ForceRefusal { get; init; } |
| | | 29 | | |
| | | 30 | | |
| | | 31 | | /// <summary>Whether the rollback would succeed: no blockers.</summary> |
| | 35 | 32 | | public bool CanRollBack => Blockers.Count == 0; |
| | | 33 | | } |