Hi,
Out of curiosity, I was tailing my mysql.log while deleting a project in Jira. I took note of the delete commands coming through the logs, and modified them a bit. What I want to do is find a way to delete all projects except a particular project (in this case 10830). I came up with this:
DELETE FROM configurationcontext WHERE PROJECT != '10830';
DELETE FROM configurationcontext WHERE PROJECT is NULL;
DELETE FROM nodeassociation WHERE SOURCE_NODE_ID != '10830';
DELETE FROM sharepermissions WHERE sharetype='project' AND PARAM1 != '10830';
DELETE FROM projectroleactor WHERE PID != '10830';
DELETE FROM projectroleactor WHERE PID is NULL;
DELETE FROM project WHERE ID != '10830';
Once those steps are complete, I run an integrity check to clean up any hanging issuelinks, etc., and re-index.
This seems to work in my test instance.
Any problems with this approach (other than a lot of room for human error?) -- seems ideal when I need to clean up an instance fast in terms of removing *many* projects.