[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