Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it safe to delete rows from the SQLite "cmd" table? #361

Open
nedbat opened this issue May 11, 2023 · 2 comments
Open

Is it safe to delete rows from the SQLite "cmd" table? #361

nedbat opened this issue May 11, 2023 · 2 comments

Comments

@nedbat
Copy link

nedbat commented May 11, 2023

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
Copy link
Author

nedbat commented May 11, 2023

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
Copy link
Owner

cantino commented May 25, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants