fix: use postgres drop commands
Some checks failed
Continuous Delivery / build_n_upload (push) Has been cancelled

This commit is contained in:
2026-04-06 09:24:18 +02:00
parent d04bdce2f7
commit 3048ea2716

View File

@@ -58,6 +58,8 @@ rm --recursive %{_tmppath}/gitea_images
# Create postgres user and db # Create postgres user and db
if ! runuser --user=postgres -- psql --quiet --tuples-only --command='\du' | grep --quiet gitea; then if ! runuser --user=postgres -- psql --quiet --tuples-only --command='\du' | grep --quiet gitea; then
runuser --user=postgres -- createuser gitea runuser --user=postgres -- createuser gitea
fi
if ! runuser --user=postgres -- psql --quiet --tuples-only --command='\l' | grep --quiet gitea; then
runuser --user=postgres -- createdb --owner=gitea gitea runuser --user=postgres -- createdb --owner=gitea gitea
fi fi
@@ -103,8 +105,11 @@ if [ $1 == 0 ]; then
fi fi
# Remove gitea database if existing # Remove gitea database if existing
if runuser --user=postgres -- psql --quiet --tuples-only --command='\l' | grep --quiet gitea; then
runuser --user=postgres -- dropdb gitea
fi
if runuser --user=postgres -- psql --quiet --tuples-only --command='\du' | grep --quiet gitea; then if runuser --user=postgres -- psql --quiet --tuples-only --command='\du' | grep --quiet gitea; then
runuser --user=postgres -- psql --command='DROP DATABASE gitea; DROP USER gitea;' runuser --user=postgres -- dropuser gitea
fi fi
# Remove actrunner users if existing # Remove actrunner users if existing