Last active
November 26, 2020 14:23
-
-
Save ts-ign0re/770ef70a697cdee65b5f78b4b3fab440 to your computer and use it in GitHub Desktop.
Firebase: export from firestore A to firestore B
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
FOLDER_NAME=`date +\%y\%m\%d\%s` | |
echo "Enter bucket identifier (you can find it in project Settings)" | |
read BUCKET_NAME | |
echo "Enter target bucket" | |
read TARGET_BUCKET | |
gcloud config set project BUCKET_NAME && | |
gcloud firestore export gs://$BUCKET_NAME.appspot.com/backups/$FOLDER_NAME && | |
gsutil -m cp -R gs://$BUCKET_NAME.appspot.com/backups/$FOLDER_NAME . && | |
gcloud config set project $TARGET_BUCKET && | |
cd backups && gsutil cp -r $FOLDER_NAME gs://$TARGET_BUCKET.appspot.com/backups && | |
gcloud firestore import gs://$TARGET_BUCKET.appspot.com/backups/$FOLDER_NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment