Creating script to reset tags.

This commit is contained in:
Roland 2026-02-14 15:37:09 -07:00
parent 18d3cfd686
commit 48acfc62bc
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680

22
scripts/reset_tags.sh Executable file
View file

@ -0,0 +1,22 @@
#!/usr/bin/env bash
source /opt/wrolpi/wrolpi/scripts/lib.sh
# Re-execute this script if it wasn't called with sudo.
if [ $EUID != 0 ]; then
sudo "$0" "$@"
exit $?
fi
yes_or_no "Are you sure you want to delete all tags? This cannot be undone." || exit 0
set -x
systemctl stop wrolpi-api
# Delete all tag relationships and tags from the database.
sudo -iu postgres psql -d wrolpi -c "DELETE FROM tag_zim;"
sudo -iu postgres psql -d wrolpi -c "DELETE FROM tag_file;"
sudo -iu postgres psql -d wrolpi -c "DELETE FROM tag;"
systemctl start wrolpi-api