* Scripts/sql-update-1.3.16_to_1.3.17-mysql.sh
* Scripts/sql-update-1.3.16_to_1.3.17.sh: New scripts to expand c_cycleinfo to mediumtext or varchar(1000000) The field was expanded around 1.3.3. See http://www.sogo.nu/bugs/view.php?id=1848 Monotone-Parent: 1bcd208d669189aec549aa4351b9d92a29c6d9b9 Monotone-Revision: f489c387ef5efde7f9beee4a9b97ecf85275ffb2 Monotone-Author: jraby@inverse.ca Monotone-Date: 2012-07-18T15:30:38maint-2.0.2
parent
6f0f95d253
commit
c88d86ec95
|
@ -1,3 +1,10 @@
|
|||
2012-07-18 Jean Raby <jraby@inverse.ca>
|
||||
* Scripts/sql-update-1.3.16_to_1.3.17-mysql.sh
|
||||
* Scripts/sql-update-1.3.16_to_1.3.17.sh:
|
||||
New scripts to expand c_cycleinfo to mediumtext or varchar(1000000)
|
||||
The field was expanded around 1.3.3.
|
||||
See http://www.sogo.nu/bugs/view.php?id=1848
|
||||
|
||||
2012-07-16 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* Tests/Integration/webdavlib.py (WebDAVQuery.set_response): make
|
||||
|
@ -21967,3 +21974,4 @@
|
|||
2006-06-15 ludovic@inverse.ca
|
||||
|
||||
* Initial import of SOGo from trunk.
|
||||
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# This script only works with mysql
|
||||
# updates c_cycleinfo to mediumtext
|
||||
# http://www.sogo.nu/bugs/view.php?id=1848
|
||||
# the field length was actually changed somewhere between 1.3.2 and 1.3.3
|
||||
# but no one reported any breakage.
|
||||
|
||||
# this script only works with MySQL
|
||||
|
||||
defaultusername=$USER
|
||||
defaulthostname=127.0.0.1
|
||||
defaultdatabase=$USER
|
||||
indextable=$(su - sogo -c "defaults read sogod OCSFolderInfoURL" | awk -F/ '{print $NF}')
|
||||
if [ -z "$indextable" ]; then
|
||||
echo "Couldn't fetch OCSFolderInfoURL value, aborting" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
read -p "Username ($defaultusername): " username
|
||||
read -p "Hostname ($defaulthostname): " hostname
|
||||
read -p "Database ($defaultdatabase): " database
|
||||
|
||||
if [ -z "$username" ]
|
||||
then
|
||||
username=$defaultusername
|
||||
fi
|
||||
|
||||
if [ -z "$hostname" ]
|
||||
then
|
||||
hostname=$defaulthostname
|
||||
fi
|
||||
|
||||
if [ -z "$database" ]
|
||||
then
|
||||
database=$defaultdatabase
|
||||
fi
|
||||
|
||||
sqlscript=""
|
||||
|
||||
function growVC() {
|
||||
oldIFS="$IFS"
|
||||
IFS=" "
|
||||
part="`echo -e \"ALTER TABLE $table MODIFY c_cycleinfo mediumtext;\\n\"`";
|
||||
sqlscript="$sqlscript$part"
|
||||
IFS="$oldIFS"
|
||||
}
|
||||
|
||||
echo "This script will ask for the sql password twice" >&2
|
||||
echo "Converting c_cycleinfo from VARCHAR(1000) to mediumtext in calendar quick tables" >&2
|
||||
tables=`mysql -p -s -u $username -h $hostname $database -e "select SUBSTRING_INDEX(c_quick_location, '/', -1) from $indextable where c_path3 = 'Calendar';"`
|
||||
|
||||
for table in $tables;
|
||||
do
|
||||
growVC
|
||||
done
|
||||
|
||||
echo "$sqlscript" | mysql -p -s -u $username -h $hostname $database
|
|
@ -0,0 +1,55 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
# This script only works with PostgreSQL
|
||||
# updates c_cycleinfo to varchar(1000000).
|
||||
# http://www.sogo.nu/bugs/view.php?id=1848
|
||||
# the field length was actually changed somewhere between 1.3.2 and 1.3.3
|
||||
# but no one reported any breakage.
|
||||
|
||||
defaultusername=$USER
|
||||
defaulthostname=localhost
|
||||
defaultdatabase=$USER
|
||||
#indextable=sogo_folder_info
|
||||
indextable=$(su - sogo -c "defaults read sogod OCSFolderInfoURL" | awk -F/ '{print $NF}')
|
||||
if [ -z "$indextable" ]; then
|
||||
echo "Couldn't fetch OCSFolderInfoURL value, aborting" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
read -p "Username ($defaultusername): " username
|
||||
read -p "Hostname ($defaulthostname): " hostname
|
||||
read -p "Database ($defaultdatabase): " database
|
||||
|
||||
if [ -z "$username" ]
|
||||
then
|
||||
username=$defaultusername
|
||||
fi
|
||||
if [ -z "$hostname" ]
|
||||
then
|
||||
hostname=$defaulthostname
|
||||
fi
|
||||
if [ -z "$database" ]
|
||||
then
|
||||
database=$defaultdatabase
|
||||
fi
|
||||
|
||||
sqlscript=""
|
||||
|
||||
function growVC() {
|
||||
oldIFS="$IFS"
|
||||
IFS=" "
|
||||
part="`echo -e \"ALTER TABLE $table ALTER COLUMN c_cycleinfo TYPE VARCHAR(1000000);\\n\"`";
|
||||
sqlscript="$sqlscript$part"
|
||||
IFS="$oldIFS"
|
||||
}
|
||||
|
||||
echo "Converting c_cycleinfo from VARCHAR(1000) to VARCHAR(1000000) in calendar quick tables" >&2
|
||||
tables=`psql -t -U $username -h $hostname $database -c "select split_part(c_quick_location, '/', 5) from $indextable where c_path3 = 'Calendar';"`
|
||||
|
||||
for table in $tables;
|
||||
do
|
||||
growVC
|
||||
done
|
||||
|
||||
echo "$sqlscript" | psql -q -e -U $username -h $hostname $database
|
Loading…
Reference in New Issue