phpVMS 1.1.400 released, lessons learned

I put out the update for 1.1.400 (version bump, went from 1.0 to 1.1 because of “major” features), then the 400 being the revision number from SVN. So far no problems, my main concern were the tons of database changes, including the removal of foreign keys, which made me a bit nervous, since I guess different versions react differently.

Instead of doing scratch installs, and then doing an update (time consuming), I wrote a quick SQL file, and another bash script which would automatically insert the older 1.0 database (basically running the install.sql), and then run the update.sql, and report any errors which are thrown:

[bash]
#!/bin/bash

# MySQL Installer and Update Check
# Nabeel Shahzad <http://www.nsslive.net>

DBUSER=""
DBPASS=""
DBNAME=""
DBSERVER=""
INSTALLFILE=’install.sql’
UPDATEFILE=’update.sql’

mysql -u uname dbname -e "show tables" | grep -v Tables_in | grep -v "+" | \
gawk ‘{print "drop table " $1 ";"}’ | mysql -u uname dbname

mysql -u $DBUSER -p $DBPASS -h $DBSERVER $DBNAME < $INSTALLFILE
clear

mysql -u $DBUSER -p $DBPASS -h $DBSERVER $DBNAME < $UPDATEFILE
[/bash]

The line to drop all the tables was from this page here (thanks!). My install.sql can also include the SQL inserts for default values (I will post the code for my installer soon, since it’ll just read any .sql file), but what I will do is create a backup of an existing DB with all my data, and run the update against that using this script.

Pretty basic, but really handy to just viewing errors.

Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • HackerNews
  • Netvibes
  • Reddit
  • StumbleUpon
  • Twitter
  • Yahoo! Buzz

One Response - Add Yours+

  1. RYErnest says:

    Nice post u have here :D Added to my RSS reader

Leave a Reply