android - Is there a way to version objects in Firebase that are meant to be read-only? -


i working on app cross-platform: web, android, ios. have couple objects intended specify constants, valid states. example:

{     "states": {         "valid": 0,         "invalid": 1     } } 

now i've released clients use object , they're out in wild, realize object doesn't meet needs , needs change. right i've created versioned object this:

{     "states2": {         "valid": {             "id": 0,             "name": "valid entry"         },         "invalid": {             "id": 1,             "name": "invalid entry"         } } 

right plan leave states object, , data states2 in newer clients, seems terrible leave kind of legacy cruft around. question:

1) there way version objects firebase provides?

or

2) using firebase in way isn't meant used?

or

3) there better way structure kind of read-only data in firebase?

  1. no, firebase has no built-in versioning.

  2. not @ all. common problem database schema upgrade in client-server context i've ever seen. catering multiple versions of clients while upgrading database schema not simple, no matter database use.

    there few common ways of handling this:

    • what you've done way of solving this: create secondary data structure has new structure. if structure writeable, means you'll have reconcile writes update both locations. , since can't update old app, you'll have part of non-client script. yup, it's painful.

    • one alternative see forced upgrade, means keep top-level current-schema-version in database , client checks whether can read/write version. if not, aborts.

  3. the best structure data, depends on needs of application. it's impossible best. initial data structure seemed reasonable me, found out limiting.

    given read-only (probably administrative) data, i'd recommend setting admin dashboard application. when add new state in dashboard, can write both places.


Comments

Popular posts from this blog

android - How to save instance state of selected radiobutton on menu -

python 3 IndexError: list index out of range -

IF statement in MySQL trigger -