13cfabbfa6
Update the table creation statements for mysql to use 'mediumtext' instead of 'text' for the c_content column. The latter is only 64k chars long, which is not enough. Monotone-Parent: f66b516a4e4c827bd8733fd6903ca41528172989 Monotone-Revision: 36b1155b71ef197756bd93ba282a5a89126511e7 Monotone-Author: jraby@inverse.ca Monotone-Date: 2012-01-03T20:42:34
45 lines
910 B
Bash
Executable file
45 lines
910 B
Bash
Executable file
#!/bin/bash
|
|
|
|
# This script only works with PostgreSQL
|
|
|
|
defaultusername=$USER
|
|
defaulthostname=localhost
|
|
defaultdatabase=$USER
|
|
indextable=sogo_folder_info
|
|
|
|
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 convVCtoText() {
|
|
oldIFS="$IFS"
|
|
IFS=" "
|
|
part="`echo -e \"ALTER TABLE $table ALTER COLUMN c_content TYPE TEXT;\\n\"`";
|
|
sqlscript="$sqlscript$part"
|
|
IFS="$oldIFS"
|
|
}
|
|
|
|
tables=`psql -t -U $username -h $hostname $database -c "select split_part(c_location, '/', 5) from $indextable;"`
|
|
|
|
for table in $tables;
|
|
do
|
|
convVCtoText
|
|
done
|
|
|
|
echo "$sqlscript" | psql -q -e -U $username -h $hostname $database
|