DDL changes in mutiple Slony sets
I had a client scenario where we were replicating 16 different schemas using 16 sets with Slony and while doing DDL statements it was kind of confusing for the customer to remember which schema has what set number.
In the end I came up with a simple script that used to take input as:
executeDDL.sh schemaname ddl.sql
Here is how the script was…
STR_SCHEMA=$1
STR_FILE=$2
echo "Schema is" $STR_SCHEMAecho "Filename is" $STR_FILEnames=( scehama1
scehama2 scehama3 scehama4 scehama5 scehama6 scehama7 scehama8
scehama9 scehama10 scehama11 scehama12 scehama13 scehama14
scehama15 scehama16 )
num=1
for (( i = 0 ; i < ${#names[@]} ; i++ ))
do
nm=${names[$i]}
j=`expr $num + $i`
if [ $nm = $STR_SCHEMA ]
then
SCHEMA_ID=$j
fi
done
echo "Set ID for Schema is" $SCHEMA_IDecho "Executing Command" "slonik_execute_script --config=slon_tools.conf $SCHEMA_ID $STR_FILE | slonik"
slonik_execute_script --config=slon_tools.conf $SCHEMA_ID $STR_FILE | slonik
–
Shoaib Mir
shoaibmir[@]gmail.com
Categories: PostgreSQL
DDL, Slony
Ey that’s nice, but you should try Slony-ctl. A brand new project (at least in the PgFoundry tree) developed in France.
Thanks for pointing it out, I did download it when it was released but just never got time to try it… will surely do it first thing as I get a little time free.