Is it safe to delete rows from the SQLite "cmd" table?
nedbat opened this issue · 2 comments
nedbat commented
I have some commands in my ~/.mcfly/history.db
database that include credentials. I would like to get rid of them. I can't make them appear in the UI (for some reason), so I can't delete them with F2. I can open the .db and use litecli to delete rows, but I don't know if I'll be breaking some constraints if I use that blunt a hammer.
Any advice?
nedbat commented
The reason I couldn't see the commands: I had set MCFLY_HISTORY_LIMIT=50000
. Changing that value let me find the commands and delete them with F2, but it would still be easier to do it with SQLite.
cantino commented
Deleting a command in the source code is the following:
pub fn delete_command(&self, command: &str) {
self.connection
.execute(
"DELETE FROM selected_commands WHERE cmd = :command",
&[(":command", &command)],
)
.unwrap_or_else(|err| {
panic!(
"McFly error: DELETE from selected_commands to work ({})",
err
)
});
self.connection
.execute(
"DELETE FROM commands WHERE cmd = :command",
&[(":command", &command)],
)
.unwrap_or_else(|err| panic!("McFly error: DELETE from commands to work ({})", err));
}
So you should clean up both commands and selected_commands.