add fix_collation_mismatch function for db container

This commit is contained in:
2025-09-23 15:57:48 +02:00
parent 9d1d89ff81
commit fde3efb0d0

24
abra.sh
View File

@ -21,8 +21,7 @@ export PG_BACKUP_VERSION=v2
export ENTRYPOINT_CSS_VERSION=v1
customize() {
if [ -z "$1" ]
then
if [ -z "$1" ]; then
echo "Usage: ... customize <assets_path>"
exit 1
fi
@ -36,8 +35,7 @@ customize() {
}
shell() {
if [ -z "$1" ]
then
if [ -z "$1" ]; then
echo "Usage: ... shell <python code>"
exit 1
fi
@ -45,8 +43,7 @@ shell(){
}
import_user() {
if [ -z "$1" ]
then
if [ -z "$1" ]; then
echo "Usage: ... import_user <users.csv>"
exit 1
fi
@ -221,8 +218,6 @@ else:
""" 2>&1 | quieten
}
quieten() {
# 'SyntaxWarning|version_regex|"http\['
# is a workaround to get rid of some verbose syntax warnings, this might be fixed with another version
@ -237,8 +232,7 @@ done
}
set_icons() {
if [ -n "$1" ]
then
if [ -n "$1" ]; then
APP_ICONS="$1"
fi
for icon in $APP_ICONS; do
@ -252,8 +246,7 @@ done
}
set_extra_icons() {
if [ -z "$EXTRA_ICONS" ]
then
if [ -z "$EXTRA_ICONS" ]; then
echo "Variable EXTRA_ICONS is not set"
exit 1
fi
@ -316,3 +309,10 @@ get_user_uid() {
print(User.objects.filter(username='$1').first().uid)
""" 2>&1 | quieten
}
fix_collation_mismatch() {
psql -U ${POSTGRES_USER} -d authentik -c "ALTER DATABASE authentik REFRESH COLLATION VERSION;"
psql -U ${POSTGRES_USER} -d authentik -c "REINDEX DATABASE authentik;"
psql -U ${POSTGRES_USER} -d postgres -c "ALTER DATABASE postgres REFRESH COLLATION VERSION;"
psql -U ${POSTGRES_USER} -d postgres -c "REINDEX DATABASE postgres;"
}