(feat) added c_description to calendar quick tables
parent
c1ce32ac94
commit
5cf500d560
|
@ -3,7 +3,8 @@
|
|||
set -e
|
||||
|
||||
# This script only works with MySQL
|
||||
# updates c_partstates to mediumtext.
|
||||
# updates c_partstates to mediumtext
|
||||
# adds c_description to Calendar quick tables
|
||||
# http://www.sogo.nu/bugs/view.php?id=3175
|
||||
# the field length was actually changed in v2.2.18
|
||||
|
||||
|
@ -37,11 +38,12 @@ then
|
|||
|
||||
sqlscript=""
|
||||
|
||||
function growVC() {
|
||||
function adjustSchema() {
|
||||
oldIFS="$IFS"
|
||||
IFS=" "
|
||||
part="`echo -e \"ALTER TABLE $table MODIFY c_partstates mediumtext;\\n\"`";
|
||||
sqlscript="$sqlscript$part"
|
||||
part1="`echo -e \"ALTER TABLE $table MODIFY c_partstates mediumtext;\\n\"`";
|
||||
part2="`echo -e \"ALTER TABLE $table ADD COLUMN c_description mediumtext;\\n\"`";
|
||||
sqlscript="$sqlscript$part1$part2"
|
||||
IFS="$oldIFS"
|
||||
}
|
||||
|
||||
|
@ -51,7 +53,7 @@ tables=`mysql -p -s -u $username -h $hostname $database -e "select SUBSTRING_IND
|
|||
|
||||
for table in $tables;
|
||||
do
|
||||
growVC
|
||||
adjustSchema
|
||||
done
|
||||
|
||||
echo "$sqlscript" | mysql -p -s -u $username -h $hostname $database
|
||||
|
|
|
@ -2,7 +2,8 @@
|
|||
|
||||
set -e
|
||||
# This script only works with PostgreSQL
|
||||
# updates c_partstates to text.
|
||||
# updates c_partstates to text
|
||||
# adds c_description to Calendar quick tables
|
||||
# http://www.sogo.nu/bugs/view.php?id=3175
|
||||
# the field length was actually changed in v2.2.18
|
||||
|
||||
|
@ -35,11 +36,12 @@ fi
|
|||
|
||||
sqlscript=""
|
||||
|
||||
function growVC() {
|
||||
function adjustSchema() {
|
||||
oldIFS="$IFS"
|
||||
IFS=" "
|
||||
part="`echo -e \"ALTER TABLE $table ALTER COLUMN c_partstates TYPE TEXT;\\n\"`";
|
||||
sqlscript="$sqlscript$part"
|
||||
part1="`echo -e \"ALTER TABLE $table ALTER COLUMN c_partstates TYPE TEXT;\\n\"`";
|
||||
part2="`echo -e \"ALTER TABLE $table ADD COLUMN c_description TEXT;\\n\"`";
|
||||
sqlscript="$sqlscript$part1$part2"
|
||||
IFS="$oldIFS"
|
||||
}
|
||||
|
||||
|
@ -48,7 +50,7 @@ tables=`psql -t -U $username -h $hostname $database -c "select split_part(c_quic
|
|||
|
||||
for table in $tables;
|
||||
do
|
||||
growVC
|
||||
adjustSchema
|
||||
done
|
||||
|
||||
echo "$sqlscript" | psql -q -e -U $username -h $hostname $database
|
||||
|
|
Loading…
Reference in New Issue