Migration was previously applied but is missing in the resolved migrations

Hi!

I built a git checkout of atuin and ran a command with the resulting client, but it seems it updated my local config as a result, and now the locally installed, stable, atuin client complains:

Error: migration 20231127090831 was previously applied but is missing in the resolved migrations                                                                                                                    
                                                                                                                                                                                                                    
Location:                                                                                                                                                                                                           
    /var/home/phil/.cargo-home/registry/src/index.crates.io-6f17d22bba15001f/atuin-client-17.2.1/src/record/sqlite_store.rs:53:9

Is there a way to fix this?

Is it possible to run the unstable/git client without affecting the local db?

Hey! Welcome to the forum!

20231127090831 is a migration to the record store, which unless you’re relying on/using the kv store is safe to delete.

rm ~/.local/share/atuin/records*

Note the *, as it also ensures any WAL files are cleaned up too.

Is it possible to run the unstable/git client without affecting the local db?

You can override the config directory with ATUIN_CONFIG_DIR, and then supply config that points to different databases. Might be worth adding an ATUIN_DATA_DIR or something that overrides the whole lot.

To anyone finding this on google post v17.2.1: do not delete the record database.

1 Like

Thanks Ellie!

The first answer worked, thanks :slight_smile:

About ATUIN_CONFIG_DIR though, it doesn’t seem to work here. In my fish shell, I run env ATUIN_CONFIG_DIR=/tmp cargo run --release -- stats year and it still “corrupts” my ~/.local/share/atuin/ folder.

I ran into this problem as well. The sample config lists a db_path value but doesn’t mention that there’s a record_store_path as well (yet). I have been using the following for testing stuff and it seems to work for now.

export ATUIN_DB_PATH=/tmp/atuin_dev.db
export ATUIN_RECORD_STORE_PATH=/tmp/atuin_records.db
export PATH=./target/debug:$PATH

I had to set the PATH as well so that the pre-exec scripts were using the locally built version.

Do you have a config file in /tmp? I’m guessing it’s still going to fall back to using default directories if not.

2 Likes

Indeed, that works here as well. Thanks!

Do you have a config file in /tmp?

No I didn’t.

I guess I’ll add these in a .envrc file :slight_smile: Thanks for the help, much appreciated!

I can send a PR updating CONTRIBUTING.md accordingly. That might help other newcomers in the future.

1 Like

Yes please! That would be fantastic :pray: