diff --git a/SOPE/GDLContentStore/GCSSpecialQueries.m b/SOPE/GDLContentStore/GCSSpecialQueries.m index 13e2634e9..84468906c 100644 --- a/SOPE/GDLContentStore/GCSSpecialQueries.m +++ b/SOPE/GDLContentStore/GCSSpecialQueries.m @@ -258,7 +258,7 @@ static NSString *sqlFolderFormat = (@"CREATE TABLE %@ (\n" @" c_name VARCHAR (255) NOT NULL PRIMARY KEY,\n" - @" c_content TEXT NOT NULL,\n" + @" c_content MEDIUMTEXT NOT NULL,\n" @" c_creationdate INT NOT NULL,\n" @" c_lastmodified INT NOT NULL,\n" @" c_version INT NOT NULL,\n" diff --git a/Scripts/sql-update-1.3.11_to_1.3.12.sh b/Scripts/sql-update-1.3.11_to_1.3.12.sh new file mode 100755 index 000000000..17b8c0405 --- /dev/null +++ b/Scripts/sql-update-1.3.11_to_1.3.12.sh @@ -0,0 +1,44 @@ +#!/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