Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

More databases inside the same Firebase Project

In the new Console in a Firebase Project, in Project Setting session in the Database tab there is the label Databases.

However I didn't find any action to create more than 1 database inside the same Firebase Project.

Is it possible to create more databases inside the same Firebase Project?

enter image description here

like image 754
Gabriele Mariotti Avatar asked May 21 '16 16:05

Gabriele Mariotti


1 Answers

Multi-database is a new feature that allows you to create multiple database instances.

To get started you need to be in the Blaze plan. In the data viewer you can click the triple dot icon to create new database instances:

enter image description here

To access data from a secondary instance you use an absolute URL when creating a database instance.

const app = firebase.initializeApp({
  // use your main config
  databaseUrl: "https://multi-db.firebaseio.com/"
});
const db1 = app.database(); // This is the default DB
const db2 = app.database("https://multi-db501c7.firebaseio.com/");

Since these databases are in the same project they share the same Authentication session.

Also each database instance has its own set of security rules and the databases can handle different structures.

like image 56
Gabriele Mariotti Avatar answered Nov 15 '22 04:11

Gabriele Mariotti