v3.42.12: Require cleanup confirmation for cluster restore with existing DBs
- Block cluster restore if existing databases found and cleanup not enabled - User must press 'c' to enable 'Clean All First' before proceeding - Prevents accidental data conflicts during disaster recovery - Bug #24: Missing safety gate for cluster restore
This commit is contained in:
@@ -306,6 +306,12 @@ func (m RestorePreviewModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
return m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cluster-specific check: must enable cleanup if existing databases found
|
||||||
|
if m.mode == "restore-cluster" && m.existingDBCount > 0 && !m.cleanClusterFirst {
|
||||||
|
m.message = errorStyle.Render("[FAIL] Cannot proceed - press 'c' to enable cleanup of " + fmt.Sprintf("%d", m.existingDBCount) + " existing database(s) first")
|
||||||
|
return m, nil
|
||||||
|
}
|
||||||
|
|
||||||
// Proceed to restore execution
|
// Proceed to restore execution
|
||||||
exec := NewRestoreExecution(m.config, m.logger, m.parent, m.ctx, m.archive, m.targetDB, m.cleanFirst, m.createIfMissing, m.mode, m.cleanClusterFirst, m.existingDBs, m.saveDebugLog, m.workDir)
|
exec := NewRestoreExecution(m.config, m.logger, m.parent, m.ctx, m.archive, m.targetDB, m.cleanFirst, m.createIfMissing, m.mode, m.cleanClusterFirst, m.existingDBs, m.saveDebugLog, m.workDir)
|
||||||
return exec, exec.Init()
|
return exec, exec.Init()
|
||||||
|
|||||||
Reference in New Issue
Block a user