0

I have been using MySql for a few decades now and have just inherited a code base which uses FireBase, of which I have zero previous experience.

My first thought is to look at the database schema, to see how it all hangs together. In SQL terminology, I would look at the "tables" (nodes in FB?) and find "foreign keys" which are indices into to other tables.

For instance the "orders" table/node has an entry for "user_id", which is obviously an index into the "users" table/node.

I am prepared to do this manually, and generate a diagram which I can use for personal reference and for the documentarian. For MySql, there are many tools which will reverse engineer the database and spit out such a diagram.

Is there something analogous for Firebase? Preferably Windows base, but web based is also acceptable. In fact, I wonder if this ability is built into Firebase somewhere and I am misplay unaware of it.

1 Answer 1

1

Unfortunately there's no easy way to do what you're asking. Firebase uses a NoSQL database, which is just a gigantic JSON file. Everything is developer defined and can very easily be changed to account for new fields or to ignore old ones.

An example of this would be if you look at Users node, you can see an entry like this:

users
  - $userID
    - name: "John Doe"

The problem is that it's possible the developer only requires the name to exist for a user to be valid but allows optional fields like the following:

users
  $userID
    name: "Jane Doe"
    gender: "female"
    birthday: "1.20.2000"
    profile_photo: "www.random-url.com"
    preferences
      dark_mode: true
      notifications_off: true

So even if you found a tool, if the database doesn't have at least one entry that contains every single possible field for every single node, then it would still be incomplete.

My advice is to just ask the developer for a list of the classes they use from derived database data.

Best of luck!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.