(&self, table_name: &str)
| 99 | /// Restore a table from its backup |
| 100 | #[allow(dead_code)] |
| 101 | pub fn restore_from_backup(&self, table_name: &str) -> Result<bool> { |
| 102 | let source_path = self.get_table_path(table_name)?; |
| 103 | let backup_path = create_backup_path(&source_path); |
| 104 | |
| 105 | if !backup_path.exists() { |
| 106 | return Ok(false); |
| 107 | } |
| 108 | |
| 109 | fs::copy(&backup_path, &source_path).map_err(|e| { |
| 110 | Error::BackupFailed(format!( |
| 111 | "Failed to restore {} from {}: {}", |
| 112 | source_path.display(), |
| 113 | backup_path.display(), |
| 114 | e |
| 115 | )) |
| 116 | })?; |
| 117 | |
| 118 | Ok(true) |
| 119 | } |
| 120 | |
| 121 | /// Get the file path for a table |
| 122 | fn get_table_path(&self, table_name: &str) -> Result<PathBuf> { |
nothing calls this directly
no test coverage detected