Files
purple-explorer/scripts/delete_database.sh
T
Joe Uhren aa1765d8d9 Add 2 network charts to page header
-Hashrate chart is populated from get_hashrate
-Difficulty chart is populated from get_difficulty
-Added a networkhistories collection to hold the new network data
-Index sync and resync functions now check for and update network history data at the end of the sync process
-restore_backup.sh and delete_database.sh scripts now drop the new networkhistories collection
-Added a new javascript library chartjs-plugin-crosshair which adds crosshair functionality to the new chart.js line charts
-Added new settings to settings.json for controlling things like collecting network_history data, independently enabling/disabling the network charts and changing colors of various aspects of the charts
-Updated README to introduce the network charts and added a line for the chartjs-plugin-crosshair library
2022-04-11 01:37:27 -06:00

40 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# Find the absolute path to this script file
SCRIPT_PATH=`dirname "$0"`
SCRIPT_PATH=`( cd "$SCRIPT_PATH" && pwd )`
# Remove temp file if it exists from last time
if [ -f "${SCRIPT_PATH}/del.tmp" ]; then
rm -f "${SCRIPT_PATH}/del.tmp"
fi
# Prompt for deleting database
echo "You are about to delete the entire eIquidus database."
echo "Are you sure you want to do this? [y/n]: ";
read -p "" DELETE_ANSWER
# Determine if the database should be deleted
case "$DELETE_ANSWER" in
y|Y|yes|Yes|YES) ;;
*) echo "Process aborted. Nothing was deleted." && exit ;;
esac
# Erase entire database
sudo touch "${SCRIPT_PATH}/del.tmp" && mongo <<EOF
use explorerdb
db.addresses.drop()
db.addresstxes.drop()
db.networkhistories.drop()
db.coinstats.drop()
db.heavies.drop()
db.markets.drop()
db.masternodes.drop()
db.peers.drop()
db.richlists.drop()
db.txes.drop()
exit
EOF
# Check if the temp file exists to determine if the delete was successful or not
if [ -f "${SCRIPT_PATH}/del.tmp" ]; then
rm -f "${SCRIPT_PATH}/del.tmp"
echo "Finished deleting database."
else
echo "Process aborted. Nothing was deleted."
fi