deltachat / deltachat-core-rust

Delta Chat Rust Core library, used by Android/iOS/desktop apps, bindings and bots 📧
https://delta.chat/en/contribute
Other
630 stars 80 forks source link

Migration collision #5719

Closed link2xt closed 1 week ago

link2xt commented 1 week ago

We have two migrations with the same number: https://github.com/deltachat/deltachat-core-rust/blob/72a1406b86e5dc5ee1a0b89bd20a92ee47e29bb4/src/sql/migrations.rs#L910-L926

It seems broken migration was introduced in 13f58e0ca54d2eb849005265417d71de0b842b01 Essentially it is https://github.com/deltachat/deltachat-core-rust/pull/5382 merged incorrectly.

We should assign it a new number now I guess.

Release 1.141.0 is broken, I will assign this migration a new number and release 1.141.1.

link2xt commented 1 week ago

I pushed commit https://github.com/deltachat/deltachat-core-rust/commit/c400491c07c993307f7c8fbbd1f6a0a0b7e1fa64 to main.

link2xt commented 1 week ago

Tagged 1.141.1

r10s commented 1 week ago

so, trying to opening a table created by 1.141.0 with 1.141.1 won't be patched but will fail with error (just tried in repl):

Error: failed to run migrations

Caused by:
    0: execute_migration failed for version 116
    1: duplicate column name: deleted
    2: Error code 1: SQL error or missing database

is that okay? desktop/ios/android never used 1.140.0, not sure where else it was really in use.

(migration 112 does not fail as the drop table seems error seems to be ignored silently)

link2xt commented 1 week ago

Databases created with 1.141.0 are broken, they don't have iroh_gossip_peers table and I am not going to try recovering such databases. Nothing was released with core 1.141.0 and it was only there for less than a week.

r10s commented 1 week ago

great, thanks for taking care and for clarifying :)

iequidoo commented 1 week ago

I scrolled up my terminal. The reason is that merge conflict didn't occur when i rebased this because i didn't add a newline before if dbversion < 111 {. This is too unreliable. Also it's not convenient to check and fix the db version every time when rebasing. I think it's better to generate the db version automatically. Then it will not be seen in the code, but it can be logged unconditionally.