简体   繁体   中英

Can we create database automatically in the firbase if the table name with the passed parameter doesn't exist in the table ? android studio

I am trying to insert the data of Railway station in the #firebase and i want to create separate table of station in the database. So if the table name with the passed parameter does not exist in the database it should be created automatically in the database(firebase)? #android #firebase

is it possible or i have to SQL or any another database.

Firebase has two databases: Realtime Database, and Cloud Firestore. While they are completely separate, neither has the concept of a table.

Luckily though both function the same when it comes to how containers for data are created (and deleted):

  1. The Realtime Database automatically creates parent nodes when you write a value under them, and it automatically deletes parent nodes when you delete the last value under them.
  2. Firestore automatically creates a collection when you write the first document to it, and it automatically deletes a collection when you delete the last value under it.

So in most cases, there is no need to worry about creation of the parent/container of your data, and the database will create/delete them automatically as needed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM