Skip to content

Instantly share code, notes, and snippets.

@abelaska
Created December 25, 2020 14:07
Show Gist options
  • Save abelaska/310537c17a545943eac19554c6600c32 to your computer and use it in GitHub Desktop.
Save abelaska/310537c17a545943eac19554c6600c32 to your computer and use it in GitHub Desktop.
Cleanup Firebase real-time database
#!/bin/bash
#
remove() {
firebase --non-interactive -P fpm-prod database:remove -y "$1"
if [ "$?" != "0" ]; then
firebase --non-interactive -P fpm-prod database:get --shallow "$1" | jq 'keys[]' -r | while read l; do
remove "$1/$l"
done
fi
}
remove "/"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment