Index: openacs-4/contrib/misc/upgrade_4.6_to_5.0.sh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/misc/upgrade_4.6_to_5.0.sh,v diff -u -N -r1.2 -r1.3 --- openacs-4/contrib/misc/upgrade_4.6_to_5.0.sh 4 Feb 2004 18:26:33 -0000 1.2 +++ openacs-4/contrib/misc/upgrade_4.6_to_5.0.sh 4 Mar 2004 13:14:43 -0000 1.3 @@ -37,6 +37,8 @@ # location of the original service export OLD_DIR=/var/lib/aolserver/$SERVICENAME +export OLD_DB_DUMP=$OLD_DIR/database-backup/$SERVICENAME_nightly.dmp +export OLD_DB_DUMP_COPY=$OLD_DIR/database-backup/$SERVICENAME_nightly.dmp.copy # location of clean 5.0 checkout export FIVE_DIR=/var/lib/aolserver/openacs-5.0.0 @@ -67,8 +69,17 @@ # $P72SQL -f pamm.sql $UP_DB # restore from last night's backup + # replace all \connect strings in the dump with the new user name + # this will solve all db permission problems IF you are using + # the naming conventions in the install docs + # we do this in perl because of bad experiences with postgres's tools and connect statements + # use a copy of the backup so that, if we screw it up, we can still repeat without getting a new one + cp $OLD_DB_DUMP $OLD_DB_DUMP_COPY + perl -p -i.tmp -e "s/^\\\\connect - .*\$/\\\\connect - $SERVICENAME/g" $OLD_DB_DUMP_COPY + + # restore from last night's backup # you are creating an automatic nightly backup, aren't you? - $P72SQL $UP_DB < $OLD_DIR/database-backup/$SERVICENAME_nightly.dmp + $P72SQL $UP_DB < $OLD_DIR/database-backup/$OLD_DB_DUMP_COPY # Upgrade from 4.6. $P72SQL -f $FIVE_DIR/packages/acs-kernel/sql/postgresql/upgrade/upgrade-4.6-4.6.1.sql $UP_DB @@ -104,19 +115,17 @@ # acs_privilege_descendant_map_vi -> acs_privilege_descendant_map_view perl -p -i.tmp -e "s/acs_privilege_descendant_map_vi([^e])/acs_privilege_descendant_map_view\\1/g" $UP_DB-4.6.3..7.2.4.munged.dmp - # run some perl from guan that changes 'timestamp with time zone' + # run some perl from guan that changes 'timestamp with time zone' # to timestamptz + # note that we don't want to change every single 'timestamp' since + # some are part of locally scoped variable names perl -p -i.tmp -e "s/timestamp with time zone/timestamptz/g" $UP_DB-4.6.3..7.2.4.munged.dmp # catch some more timestamps - those with semicolons - # note that we don't want to change every single timestamp since - # some are part of locally scoped variable names perl -p -i.tmp -e "s/(\\W)timestamp;/\\1timestamptz;/g" $UP_DB-4.6.3..7.2.4.munged.dmp - # replace all \connect strings in the dump with the new user name - # this will solve all db permission problems IF you are using - # the naming conventions in the install docs - perl -p -i.tmp -e "s/^(\\\\connect - )[\\w]*/\\1$SERVICENAME/g" $UP_DB-4.6.3..7.2.4.munged.dmp + # fix the connect strings - see previous comment + perl -p -i.tmp -e "s/^\\\\connect - .*\$/\\\\connect - $SERVICENAME/g" $UP_DB-4.6.3..7.2.4.munged.dmp echo "$(date): Finished Step 2: restore the munged database into 7.3" fi