mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-04-11 00:08:51 +00:00
See ChangeLog
Monotone-Parent: ea7589320f5747a3bd1bbec33e1bd8776e4041db Monotone-Revision: cc4b29880c63c661301ca909ec3695f67b0775dd Monotone-Author: ludovic@Sophos.ca Monotone-Date: 2009-04-21T15:20:52 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -21,6 +21,10 @@
|
||||
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
# Boston, MA 02111-1307, USA.
|
||||
|
||||
# Uncomment the following line for Oracle RAC. This is where
|
||||
# should be located the tnsnames.ora.
|
||||
#export TNS_ADMIN=/home/sogo
|
||||
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
PIDFILE=/var/run/sogo/sogod.pid
|
||||
|
||||
51
Scripts/sql-update-101_to_102.sh
Executable file
51
Scripts/sql-update-101_to_102.sh
Executable file
@@ -0,0 +1,51 @@
|
||||
#!/bin/bash
|
||||
|
||||
# this script only work 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
|
||||
|
||||
echo ""
|
||||
echo "You will now be requested your password twice..."
|
||||
echo "After that, a list of SQL operations will scroll."
|
||||
echo ""
|
||||
|
||||
sqlscript=""
|
||||
|
||||
function addField() {
|
||||
oldIFS="$IFS"
|
||||
IFS=" "
|
||||
part="`echo -e \"ALTER TABLE $table ADD COLUMN c_nextalarm INT;\\n\"`";
|
||||
sqlscript="$sqlscript$part"
|
||||
IFS="$oldIFS"
|
||||
}
|
||||
|
||||
tables=`psql -t -U $username -h $hostname $database -c "select split_part(c_quick_location, '/', 5) from $indextable where c_folder_type = 'Appointment';"`
|
||||
|
||||
for table in $tables;
|
||||
do
|
||||
addField
|
||||
done
|
||||
|
||||
echo "$sqlscript" | psql -q -e -U $username -h $hostname $database > /dev/null
|
||||
|
||||
echo "Please ignore the errors above. They just mean that the migration was already done for the elements in question.";
|
||||
Reference in New Issue
Block a user