phpBB 3 was finally released and I upgraded the ResTek/WWU Student Forums the other night. Luckily an upgrade (2.x -> 3.0) script is provided. After all of the tables are created during the guided setup process, there is also a tab for upgrading an old site. It basically just imports data from your old phpBB2 instance into the new tables and copies over avatars, etc. directly.
Anyway the process is very simple but when setting a table prefix (so you can potentially use one database for multiple forums), I set the prefix without the trailing underscore. So, all of my tables were incorrectly named things like forumsbbcodes, forumsbanlist, etc. There are about 40 tables named like this, and I didn’t want to rename them all by hand, so I came up with the list and used this short Awk script:
kian@alvis:~/testing
> awk '{ str = $0
sub(/forums/, "forums_", str)
print "RENAME TABLE", $0, "TO", str, ";"
}' tables.txt
That will create the SQL commands necessary to correctly rename each of the tables, e.g.:
RENAME TABLE forumsthis_that TO forums_this_that ;
All that is needed next is to execute these commands using mysql(1) or an interface of choice.
For Christmas books this year, I will be reading The Plague, Three Cups of Tea, and Julius Winsome (title is spelled incorrectly on the spine!). I also got a subscription to National Geographic, so I’ll be reading those as they arrive. I still need to finish The Brothers Karamazov. I’m still trying to completely understand the last two chapters I read: Rebellion and especially The Grand Inquisitor. Dostoyevsky was clearly a genius.