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

天大地大妈咪最大 提交于 2020-01-22 19:57:42

问题


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 have a JSON schema that I launch with my 1.0.0version of my android app. Later 1.0.1 comes up where I have to add some extra fields for the newer documents. Since I changed the structure to have additional information, it only applies to new documents.

Therefore, using this logic, I can see my Android application must be able to deal with all versions of JSON tree if used against this project I create in the firebase console with Firestore. But this can be very painful right, that I have carry the deadweight of backward compatibility endlessly? Is there a way to have some sort of version like in protobuf or something the android app can send to firestore server side so that automatically we can do something to prevent crashes on the android app when it sees new fields?

See also this thread, the kind of problem the engineer has posted. You can end up with this kind of problem as new fields get discovered in your JSON tree by the android app Add new field or change the structure on all Firestore documents

Any suggestions for how we should go about this?

In node.js architecture we handle this with default-> v1.1/update or default-> v1.0/update, that way we can manage the routes.

But for android+firebase SKD-> talking to Firestore NOSQL, how do I manage the versioning of the json schema.

来源:https://stackoverflow.com/questions/52109026/firestore-schema-versioning-and-backward-compatibility-with-android-app-to-preve

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!