Sometimes it takes a simple reminder that Occam's razor or the keep it simple stupid principles apply to most things in the technical realm just as it does to the real world.
In the server meltdown last week the data was all recovered but some problems with the backups made it impossible to get all of the file directories. The net result was a friend's WordPress blog melted down. Or at least all the goodies were gone. In the process of renewing the site and getting it updated a tagging plugin no-longer worked. As we talked this afternoon I looked through the database and figured out the schema and what was happening. Quickly enough I hit on a few simple queries and realized I could convert the data.
After another backup of the database it was time to set about migrating the data. The first query is:
INSERT IGNORE into wp_terms (slug, name, term_id) SELECT lower(replace(replace(replace(wp_tags.tag, '.' , ''), "'", ""), "", '')) a, replace(replace(wp_tags.tag, '-', ' '), '_', ' ') b, NULL
That runs perfectly and it was time for step two. Or it was really time for step one. Not a major WordPress user I am not terribly familiar with the community. But it hit me that I was probably not the first person to be doing this. Maybe somebody else had published the SQL to make this process easier. Read more about Occam's razor applies to technology too