Skip to content

Commit 4bb91e4

Browse files
committed
Enhance and cleanup DatabaseUpgradeChecker
Using a hierarchy of database version rather than a flat list of them. Adding a new schema upgrade path was really cumbersome and error-prone, because we needed to maintain a flat map of versions and their corresponding list of upgrade paths (`DbUpgrade`). Instead we're using a logical hierarchy structure of versions: ``` DatabaseVersionHierarchy.builder() .next("4.0.0" , new Upgrade40to41()) .next("4.0.1" , new Upgrade40to41()) .next("4.0.2" , new Upgrade40to41()) .next("4.1.0" , new Upgrade410to420()) .next("4.1.1" , new Upgrade410to420()) .next("4.2.0" , new Upgrade420to421()) ... .next("4.2.1" , new Upgrade421to430()) .next("4.9.3.0" , new Upgrade4930to41000()) .next("4.10.0.0", new Upgrade41000to41100()) .next("4.11.0.0", new Upgrade41100to41110()) .build(); ``` With this change, when we need to add a new version upgrade path, we only need to add it in correct place in the hierarchy rather than add that in dozens of places in `_upgradeMap`.
1 parent e4537e9 commit 4bb91e4

3 files changed

Lines changed: 311 additions & 410 deletions

File tree

0 commit comments

Comments
 (0)