mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-02-17 07:33:57 +00:00
fix(preferences): Fix the issue when signature is too long and preferences are not saved. Note that MySQL profile table should be updated with a migration script
This commit is contained in:
26
Scripts/sql-update-5.8.4_to_5.9.0.sh
Executable file
26
Scripts/sql-update-5.8.4_to_5.9.0.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# This script only works with PostgreSQL and MySQL - it does:
|
||||
#
|
||||
# - increase the c_defaults column of user profile table to medium text
|
||||
|
||||
profiletype=$(sogo-tool dump-defaults -f /etc/sogo/sogo.conf | awk -F\" '/ SOGoProfileURL =/ {print $2}' | awk -F: '{ print $1 }')
|
||||
|
||||
if [ -z "$profiletype" ]; then
|
||||
echo "Failed to obtain session table type" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$profiletype" == "mysql" ]]; then
|
||||
profiletable=$(sogo-tool dump-defaults -f /etc/sogo/sogo.conf | awk -F\" '/ SOGoProfileURL =/ {print $2}' | awk -F/ '{print $NF}')
|
||||
mysqlargs=$(sogo-tool dump-defaults -f /etc/sogo/sogo.conf | awk -F\" '/ SOGoProfileURL =/ {print $2}' | sed 's/mysql:\/\/\([^:]\+\):\([^@]\+\)@\([^\:]\+\):\([^\/]\+\)\/\([^\/]\+\).\+/-h \3 -P \4 -u \1 -p\2 \5/')
|
||||
echo "Converting c_defaults from TEXT to MEDIUMTEXT in sessions table ($profiletable)"
|
||||
mysql -v $mysqlargs -e "ALTER TABLE $profiletable MODIFY c_defaults MEDIUMTEXT;"
|
||||
else
|
||||
echo "Unsupported database type $profiletype"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user