This design document discusses considerations for wallet database migrations.
The schema of the GNU Taler Wallet database is evolving over time, either because new features are added or because bugs are fixed.
The schema of the wallet database is described in code in
https://git.taler.net/wallet-core.git/tree/packages/taler-wallet-core/src/db.ts#n1959
(walletStoresV1
). This schema description is used to initialize and upgrade the
database automatically.
In IndexedDB terminology, the wallet has two databases:
"taler-wallet-meta"
stores metadata about the current major-version database"taler-wallet-main-v9"
stores the
actual data of the wallet.This indirection allows major database migrations to be safe despite the limitations of IndexedDB. The computation that is allowed during an IndexedDB migration is very limited. By migrating to a completely new database, we can keep around the old database until we’re sure that the migration has succeeded and, if required, push new code to fix migration errors.
We have three different mechanisms to introduce changes to the database:
db.ts#openTalerDatabase
.
Major migrations should be used very seldomly. It can make sense to implement them
as a backup cycle, i.e. implement a backup export from the old version, upgrade to
the latest backup version and then re-import into the new major-version database.versionAdded
attribute. This causes an IndexedDB upgrade transaction
to be executed.db.ts#walletDbFixups
N/A.
(This should be filled in with results from discussions on mailing lists / personal communication.)