--- trunk/locker/bin/scripts-remove 2012-09-10 22:32:55.673904461 -0400 +++ trunk_oursrc/locker/bin/scripts-remove 2012-09-10 22:26:09.097752817 -0400 @@ -136,7 +136,34 @@ exit 1 fi -echo +#rails hack to drop foo_test, foo_development and foo_production + +railsuffixes=( "test" "development" "production" ) + +for dbsuffix in ${railsuffixes[@]}; do + raildb=`sshrun "sql/bin$scriptsdev/get-next-database" "${addrend}_$dbsuffix"` + if [ "$raildb" = "${addrend}_${dbsuffix}1" ]; then + raildb="$lname+${addrend}_$dbsuffix" + dropped=`sshrun "sql/bin$scriptsdev/drop-database" "$raildb"` + if [ "$dropped" ]; then + echo "The rails database $raildb" + echo "was successfully removed." + attach sql 2>/dev/null + if [ -f "/mit/sql/backup/$lname/$raildb.sql.gz" ]; then + echo "A one-day-old backup of your SQL database is" + echo "available in /mit/sql/backup/$lname". + fi + else + echo "ERROR:" + echo "The database $lname+$addrend_$dbsuffix" + echo "could not be automatically removed. You can" + echo "try removing it from http://sql.mit.edu/," + echo "or you can contact sql@mit.edu for assistance." + exit 1 + fi + fi +done + if [ "$sqldb" = "${addrend}1" ]; then sqldb="$lname+$addrend" dropped=`sshrun "sql/bin$scriptsdev/drop-database" "$sqldb"`