Moving in and out
Move in from Firebase
Accounts, Firestore documents and Cloud Storage files, into a new Rezin Core project. Start at Move in in your company's sidebar and choose Firebase. The general steps and safety rules are on Move a project in.
This has been tested against files shaped like Firebase's exports, not yet against a live Firebase project. Firestore is a document database and Rezin Core is PostgreSQL, so this move changes the shape of your data; you review and edit that shape before a row is written.
Upload any of the four files below. Each is optional.
Accounts
Export them with the Firebase command-line tool:
firebase auth:export users.json --format=json
To let people keep their passwords, also enter the project's password hash parameters: in the Firebase console, Authentication, the menu beside "Add user", "Password hash parameters". They look like this:
hash_config {
algorithm: SCRYPT,
base64_signer_key: 4Hk0...==,
base64_salt_separator: Bw==,
rounds: 8,
mem_cost: 14,
}
With them, each person's password is checked against Firebase's hash the first time they sign in here and stored again as an Argon2id hash. Without them, accounts are brought over with no usable password and people choose a new one with "Forgot password?". The signer key is used for this import and is not kept on the import.
What comes over: email address, display name, whether the account was disabled, Google and GitHub identities, and a row per account in a table imported_accounts with the Firebase ID, phone number, photo address, custom attributes, and the creation and last sign-in times.
Not brought over: accounts with no email address (phone-only and anonymous), other providers' identities, and accounts whose email address already has an account on Rezin Core.
Firestore
Rezin Core reads a Firestore export in JSON, in the shape the common export tools write: an object of collections, each an object of documents by ID, with subcollections under __collections__.
{
"shops": {
"s1": {
"name": "North",
"open": true,
"openedAt": { "__datatype__": "timestamp", "value": { "_seconds": 1700000000, "_nanoseconds": 0 } },
"__collections__": { "orders": { "o1": { "total": 10 } } }
}
}
}
Firebase's own managed export (the LevelDB format written to a bucket) is not read. Convert it to JSON first, or export with a tool that writes JSON. One file can be up to 96 MB; export larger collections separately.
The dry run proposes a table for each collection:
| In Firestore | Proposed |
|---|---|
| A collection | A table |
| A document's ID | The id column (text, primary key) |
| A field holding text, a number, true/false, a timestamp | A column of that type |
| A field holding a map or a list | A jsonb column |
| A subcollection | A table of its own with a parent_id column holding the parent document's ID |
| A field that holds different kinds of value in different documents | jsonb, or text |
You can rename any table or column, change any column's type, and leave out any column or whole collection, before anything is written. A value that does not fit the type you chose is reported with its batch; nothing else is held up.
Files
Supply a JSON list of your files, each with an address it can be downloaded from:
[
{ "bucket": "demo.appspot.com", "name": "docs/a.txt", "contentType": "text/plain", "url": "https://firebasestorage.googleapis.com/v0/b/demo.appspot.com/o/docs%2Fa.txt?alt=media&token=3f0c" }
]
Each file is fetched once from its address, which must be a public one, and stored in a bucket named after yours. A file that cannot be fetched is listed with the reason. One file can be up to 25 MB.
Security rules
Firebase security rules are not translated. They describe documents and paths; Rezin Core's access rules are row-level security on tables. Upload your rules file and it is shown beside your tables after the import so you can write the rules by hand. Every imported table is closed until you do. Securing tables has templates for the common cases: owner only, same organization, signed-in read, public read.
Cloud Functions
Not brought over. Each becomes a Rezin Core function.