Home > Software engineering >  Can I change the default database in Firebase RTDB?
Can I change the default database in Firebase RTDB?

Time:11-10

I created a database in the Firebase Realtime project, but now it seems that the location I picked was not the best choice, therefore I wanted to migrate the data.

It turns out that there is no possibility to automatically move/migrate the database, so I figured I would remove the invalid DB, create a new one and set it as default, then remove the old one.

Unfortunately, it seems that this is impossible as the default database doesn't have 'Delete' option as documentation mentions. API methods for firebase admin management don't have this feature listed as well.

The question is: is it possible / how to set another database as a default one?

Thanks and best regards!

CodePudding user response:

It turns out that there is no possibility to automatically move/migrate the database.

Yes, there is no way you can change the default location of the database, once it was created.

The question is: is it possible / how to set another database as a default one?

No, you cannot create "another" default database. What you can do, however, is to create a new instance of the Realtime Database that can be located in a totally different location than the default one. According to the official documentation of the Realtime Database locations:

If you create a new Realtime Database instance, you're prompted to select the location of the instance in the Firebase console workflow. Each Realtime Database instance in your project can be located in a different location. The currently supported locations for Realtime Database instances are listed below along with their associated database URL schemes.

And then use it accordingly. It's not the default one, but it will indeed do the job.

Please also see below, how you can set a different the location to a database:

  • Related