PDA

View Full Version : Prompt user to drop table on product upgrade?


vespillo
01-11-2010, 11:59 PM
Hi all,

Is there a way to create a product install xml so that it prompts the user to ask if they would rather drop the existing table for a fresh install, or use the existing information?

I am working on porting a mod to vb4.0 and everything went swimmingly except for one thing. Currently the install code is as such (snippet):

<installcode><![CDATA[$vbulletin->db->query_write("DROP TABLE IF EXISTS " . TABLE_PREFIX . "anonymous_log");

$vbulletin->db->query_write("

CREATE TABLE " . TABLE_PREFIX . "anonymous_log (

logid INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,

userid INT(10) UNSIGNED NOT NULL,

dateline INT(10) UNSIGNED NOT NULL,

postid INT(10) UNSIGNED NOT NULL,

threadid INT(10) UNSIGNED NOT NULL,

forumid SMALLINT(5) UNSIGNED NOT NULL,

PRIMARY KEY (logid)

) TYPE=MYISAM

");]]></installcode>

This is annoying because it means when I upgrade it drops the table and I lose the entire post history for this log. Is there a suggested method to doing this so that I only lose the information if I want to rather than by default?

Edit: A work around seems to be that I can set the code version for the installcode to be lower than the current revision, and it won't nuke my DB.. but I'll leave the question up since I think it's interesting in different applications.

Thanks!