Database schema update in production

前端 未结 2 1532
小鲜肉
小鲜肉 2021-01-02 01:49

I have an app installed on mobile phones where users read and write to a Firebase database. I want to do a database schema change from:

|-- \"app\"
|    |--          


        
2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-02 02:12

    Your only choice, if you want to preserve functionality on both old and new version, is to support both versions :

    • Any data structure specific of a given user needing migration can be updated once by the new app version (detect if the old format still exist and write as new).

    • If some structure has changed for global data used by all users, your database should keep data both in old and new format. Being NoSQL, this should only cause issues with write consistency (need to update all locations).

    Firebase or not, you cannot be expected to support old versions of your app forever. If you decide to support up to X previous versions, you will need to keep X versions of your data structure in parallel (and all the added complexities in writes operations).

提交回复
热议问题