P2 redesign Phase 5 — prune/check/unlock + maintenance ticker + repo stats + pending-runs queue #3
@@ -50,7 +50,7 @@ CREATE TABLE host_repo_stats (
|
|||||||
unique_files INTEGER,
|
unique_files INTEGER,
|
||||||
snapshot_count INTEGER,
|
snapshot_count INTEGER,
|
||||||
last_check_at TEXT,
|
last_check_at TEXT,
|
||||||
last_check_status TEXT, -- 'ok' | 'errors_found' | 'failed'
|
last_check_status TEXT CHECK (last_check_status IS NULL OR last_check_status IN ('ok', 'errors_found', 'failed')),
|
||||||
lock_present INTEGER NOT NULL DEFAULT 0,
|
lock_present INTEGER NOT NULL DEFAULT 0,
|
||||||
last_prune_at TEXT,
|
last_prune_at TEXT,
|
||||||
last_prune_freed_bytes INTEGER,
|
last_prune_freed_bytes INTEGER,
|
||||||
|
|||||||
@@ -138,6 +138,14 @@ func TestMigration0009Schema(t *testing.T) {
|
|||||||
if lockPresent != 0 {
|
if lockPresent != 0 {
|
||||||
t.Errorf("expected lock_present=0, got %d", lockPresent)
|
t.Errorf("expected lock_present=0, got %d", lockPresent)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CHECK (last_check_status IN ('ok','errors_found','failed')) must reject
|
||||||
|
// an invalid value.
|
||||||
|
if _, err := s.DB().ExecContext(ctx,
|
||||||
|
`UPDATE host_repo_stats SET last_check_status = ? WHERE host_id = ?`,
|
||||||
|
"wat", "h-0009"); err == nil {
|
||||||
|
t.Fatal("expected CHECK constraint violation on last_check_status='wat', got nil")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestForeignKeysEnforced(t *testing.T) {
|
func TestForeignKeysEnforced(t *testing.T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user