Is it possible to export the Firebase database and then make changes on an editor like Notepad and then import the database enforcing that only the changes made offline get updated?
For example, say I export the database today and add 6000 new child nodes through my notepad and then two days I import the database back to update it with the new nodes without affecting the other updates that have been made by my users.
What happens by default is that when I import the database it will rewrite every value that does not match. Hope I'm making sense.
As you can see from above image, firebase clearly says All data at this location will be overwritten, so you have to stop writing new data when you are updating the data by export and then import.
Now to recover such data, you can code that way to write upcoming data into json file or another database and stop writing it into firebase.
Hope this helps.
If you are using the Export JSON option from your Firebase Console, and than you make some offline changes on that file and than you use Import JSON option, no, it's not possible, because the new added file overrides the old one. So in other words, if you previously have made some changes, all the changes will be lost when you upload the modified file.
There are two options to solve this.
Stop to database for beeing written -> Export the file -> Make the changes -> Import the file.
and
Make all changes programmatically even if the database is changed by users.
Hope it helps.
Related
I have a firebase project and I added a Firestore database but I forgot to choose the right location. Since the location can not be modified after creating the database and the database is empty I would like to just delete it and create a new one with the correct location. Is this possible or do I need to create the whole project again?
Would appreciate help a lot.
Once a region is set for a project, it can't be changed. In the documentation it says:
Warning: Setting the location for one of the following services [Firestore, Storage, App Engine] also sets the location for the others. After you set your project's default GCP resource location, you cannot change it.
So, you will have to create a whole new project.
We had created the multiple databases. Now, we need to rename the database that is used for testing purpose. So, Is it possible to rename check-12cc0-test database? Please check out the image below.
You can change your project name from here
I have it in Spanish, but at the right of project overview, project configuration you should see the pencil to edit your project name.
Note you can't change your database name since it's the ID of the project, you will need to create a new one and delete the one you have to change the database name. You can only change your children and keys inside your database main tree node.
Since the id of the project can't change, this is what Firebase tells to us about it:
ID of the project
It is the unique identifier of your Firebase project. You can find it in the project URL: https://console.firebase.google.com/project/<projectId>
Remember that for edit the nodes and keys you can't do it directly from Firebase, instead you should export your JSON Database and edit it, then reupload it, or do it programmatically.
Scenario:
I want to implement user editable app settings in my symfony application but don't know what's the best practice.
The user should be able to edit global settings like company address or alike in the app backend, no user specific settings.
I had a look at the CraueConfigBundle, but I think a file based settings solution fits more to my problem.
It's difficult to find something on Google for my problem, maybe you can help me find that out.
What do you use to give your app admins the possibility to edit global settings?
For basic CraueConfigBundle can work for you (didn't use it just read docs) even tho it's saving to database.
Do you have particular reason why you need saving into file? You can always set up case to save data from database to file.
But if you want to write something in general, its require few steps like basically like this:
You need service which provide reading / uploading of configuration
This service can take use of adapters to do real Saving reading from your chosen source of data (for example you can use symfony Yaml component which can read / dump data from Yaml)
Then you need write user interface which suits your needs for that
Currently, to import bulk data to firebase, we have to go to our firebase console browse for json file and import it in. e.g. of import button
However, I want to import it without going in to the console.
That is, my system (web app) will allow admin to override all data in database with a default JSON file.
I don't think the Firebase API (https://www.firebase.com/docs/web/guide/saving-data.html) provide such feature. Any recommendations?
Create a reference to the root of your database and simply set the JSON there.
firebase.database().ref().set({
whatever: 'JSON'
});
This replaces everything that is currently in your database.
I have a drupal website where i wonna import user settings with a CSV ( Comma separate file ) file. I can do that with the user imports module. But this is manually. You need to choose a csv file and can then change some settings,... to import that file. That is no problem.
Now i wonna do that automaticly ( cron ? ). I have read that it could be done with the same user imports module. But i can't get it working. Somebody that can help me starting, to do the following.
So that he gonna see to an ftp location if there is a new csv file.
The he gonna do the import.
He must do changes for users that already exists an add new users if they doesn't exists. And for users that where deleted from the file , the user should set to inactive.
And after this, there should be a report with al the changes that are made
I would suggest using the feeds module. You can easily set it up to import on a schedule and can specify a local folder to look for new files. You can also set it up to access a remote url for the file, but only through http not ftp. We do a similar import and have a bash script that transfers the file to a local folder and then use feeds to import the resulting file.
Thanks for the advice. But i am rewriting the module into a new module. With everything i need. :)