Get available tables (files in the data directory)
(&self)
| 157 | |
| 158 | /// Get available tables (files in the data directory) |
| 159 | pub fn list_tables(&self) -> Result<Vec<String>> { |
| 160 | let mut tables = Vec::new(); |
| 161 | |
| 162 | // history.jsonl -> history table |
| 163 | if self.config.history_file().exists() { |
| 164 | tables.push("history".to_string()); |
| 165 | } |
| 166 | |
| 167 | // Codex history.jsonl -> jhistory table |
| 168 | if self.config.jhistory_file().exists() { |
| 169 | tables.push("jhistory".to_string()); |
| 170 | tables.push("codex_history".to_string()); |
| 171 | } |
| 172 | |
| 173 | // stats-cache.json -> stats table (note: renamed to avoid hyphen in SQL) |
| 174 | if self.config.stats_file().exists() { |
| 175 | tables.push("stats".to_string()); |
| 176 | } |
| 177 | |
| 178 | // Virtual multi-file tables |
| 179 | if self.config.transcripts_dir().exists() || self.config.projects_dir().exists() { |
| 180 | tables.push("transcripts".to_string()); |
| 181 | tables.push("sessions".to_string()); |
| 182 | } |
| 183 | |
| 184 | if self.config.todos_dir().exists() { |
| 185 | tables.push("todos".to_string()); |
| 186 | } |
| 187 | |
| 188 | Ok(tables) |
| 189 | } |
| 190 | } |
| 191 | |
| 192 | /// Check if a SQL statement is a write operation |
nothing calls this directly
no test coverage detected