I've been developing an install profile, and one of the tedious parts of the process is re-setting the database if I need to run through the install again.
To that end, I threw together a "Self Destruct" module that provides a single permission and a single menu callback, which executes a "SHOW TABLES" query against the database and then loops through the results, dropping each table as it goes. When it's finished, it sends the user back to install.php.
When the self-destruct module is pre-installed by the profile (during development only), it definitely speeds up the whole cycle; it's a single menu item with no confirmation or warning; just click it and it wipes the DB and drops you back at the start of the process.
Obviously, this is an extremely dangerous module, to be used only by developers who know what they're doing, and the sort of thing that should never be installed in a production environment, ever. As such, I'm hesitant to even add it to the repository... I'd appreciate any thoughts/wisdom others might have.
Thanks!
-Andy
Comments
Sounds like a handy tool
I agree with you that it is a dangerous tool. If you were going to put it up as a contrib module, maybe adding a warning and a confirmation would be the way to go.
Something like: "THIS WILL COMPLETELY EREASE YOUR DATABASE. YOU WILL CRY, PULL OUT YOUR HAIR AND KICK YOUR DOG IF THIS IS NOT WHAT YOU WANTED TO DO. ARE YOU SURE YOU WANT TO DO THIS?"
I think you can go ahead and
I think you can go ahead and publish it, if you think that it will be useful to others and that you can use the feedback. It seems well within the safety limits of the "IQ requirements" of using Drupal.
An existing somehow related module is http://drupal.org/project/demo
Better late than never
I lost the original module in a hard drive crash before I added it to contrib, and finally just got around to rebuilding it. Now with Drush support!
http://drupal.org/project/selfdestruct