3 # this script only work with PostgreSQL, which at this time is the only
4 # database really supported by SOGo/SOPE
7 defaulthostname=localhost
10 read -p "Username ($defaultusername): " username
11 read -p "Hostname ($defaulthostname): " hostname
12 read -p "Database ($defaultdatabase): " database
16 username=$defaultusername
20 hostname=$defaulthostname
24 database=$defaultdatabase
28 echo "You will now be requested your password thrice..."
29 echo "After that, a list of SQL operations will scroll."
34 function renameFields() {
40 part="`echo -e \"ALTER TABLE $table RENAME $field TO c_${field};\\n\"`";
41 sqlscript="$sqlscript$part"
46 table=sogo_user_profile
47 fields="uid defaults settings"
50 fields="uid startdate enddate cycleenddate title cycleinfo participants isallday iscycle classification status priority isopaque location orgmail partmails partstates sequence component"
51 tables=`psql -U $username -h $hostname $database -c "select split_part(c_quick_location, '/', 5) from sogo_folder_info where c_folder_type ilike 'Appointment';" | grep _quick`
57 fields="givenname cn sn l mail o ou telephonenumber screenname"
58 tables=`psql -U $username -h $hostname $database -c "select split_part(c_quick_location, '/', 5) from sogo_folder_info where c_folder_type ilike 'Contact';" | grep _quick`
64 sqlscript="$sqlscript;"
65 echo "$sqlscript" | psql -e -U $username -h $hostname $database