Firestore schema versioning and backward compatibility with android app to prevent crashes

前端 未结 1 461
盖世英雄少女心
盖世英雄少女心 2021-02-13 09:32

Firestore a NOSQL is a Document oriented database. Now how to manage versioning of the data as I use it with Firebase SDK and Android applications?

For e.g. let\'s say I

1条回答
  •  北荒
    北荒 (楼主)
    2021-02-13 10:31

    We come up to next versioning with Firestore:

    • prefer additive changes, backward compatible -> keeping structure as it was, but with adding new fields (that can be ignored by old mobile clients)
    • in case it is impossible, and we are doing backward incompatible change: we have a collection in Firestore, called 'versioning', where store clients with allowed versions. Then mobile application on lunch fetch this version for current platform and compare version from configuration with stored in Firestore - if version is less then min allowed, force upgrade required, else if version less then current, we recommend updating the client, otherwise all is fine.

    0 讨论(0)
提交回复
热议问题