HomePhabricator
Diffusion Comm 67f24417b28b

[lib] Update DB version while running a migration

Description

[lib] Update DB version while running a migration

Summary:
As a part of new migrations / backup approach, we have to store a version in SQLite. Updating this version should happen in the same transaction as all the other ops. In this new approach, we're introducing a new migrations spec - the functions return not only the state but also the ops that should be applied on the DB. Running the ops becomes a responsibility of createAsyncMigrate, which also adds one op that updates the DB version. From this point we shouldn't add any legacy migration. Also, store versions should match between the platforms.

https://linear.app/comm/issue/ENG-7006/back-up-redux-version

Depends on D11936

Test Plan:
Checked on both web and native:
created one legacy and one new migration, checked if both of them were run and that the DB version was updated in the store (killed and reopened the app, and then checked syncedMetadataStore).

Reviewers: kamil, marcin, inka

Reviewed By: kamil, marcin

Subscribers: ashoat

Differential Revision: https://phab.comm.dev/D11937

Details

Provenance
tomekAuthored on May 8 2024, 5:06 AM
Reviewer
kamil
Differential Revision
D11937: [lib] Update DB version while running a migration
Parents
rCOMM798d69edb25f: [native] Avoid flicker when deleting during save/creation
Branches
Unknown
Tags
Unknown