1

I'm creating the chat app, and wondering to know what the best way to handle situation when will be added key to a node in the json table, and pre versions of the application with old Class represents the node(with less variables) will be crashed.

For example:

mChatUser = childDataSnapshot.getValue(ChatUser.class);

In table ChatUser node have 4 String keys, as well as, ChatUser.class has 4 String variables, it is ok. But after we update ChatUser nodes to have 5 variables and ChatUser.class to have 5 variables, but app still not updated to all devices, so in old versions will be crash. How to avoid it? And best way to add keys? Thanks.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Taras Okunev
  • 410
  • 6
  • 9
  • migrate old `ChatUser`s to the new `ChatUser` model. – Shark Mar 14 '16 at 12:41
  • 1
    See http://stackoverflow.com/questions/32294158/versioning-objects-in-firebase and http://stackoverflow.com/questions/30168665/is-there-a-way-to-version-objects-in-firebase-that-are-meant-to-be-read-only and https://calendee.com/2015/05/17/api-versioning-trick-for-firebase/ – Frank van Puffelen Mar 14 '16 at 14:38
  • Thanks! Seems best way to handle DB Schema changes is to disallow use app until app is updated. What do you think about it? – Taras Okunev Mar 14 '16 at 17:15

0 Answers0