Should a package manually drop its own table upon uninstall ?

Permalink 1 user found helpful
Hi,

developping some addons for concrete5, I just run into a bit of a situation realizing that the table created during installation (using the normal db.xml way) were not dropped by uninstall ...

Reading the Concrete5_Model_Package::uninstall() function, all I can see is this code at the end :

$db->Execute("delete from Packages where pkgID = ?", array($this->pkgID));


hum, so this is not here, digging a bit more, I try to find about how it is done for block controllers, and I find this :

public function uninstall() {
    // currently blocks cannot be uninstalled
}



(in Concrete5_Library_BlockController)

Holly cow O_O ?

Now, the question is, shall I override the uninstall method to remove manually all created table (there might be an adodb helper to do so hopefully ?)

 
goutnet replied on at Permalink Best Answer Reply
I just found a likable answer from andrew :

http://www.concrete5.org/community/forums/customizing_c5/what-shoul...

Quote :

"Now, we don't automatically remove database tables in this process, so you could potentially override the uninstall method and drop the tables manually, but I don't really believe its necessary. In the core, in the future, we might actually do this, but right now we're not."

Question answered … (I leave this behind so that some others might read the solution)
goutnet replied on at Permalink Reply
Just some hints for those (like me) who are trying to implement something like this

you need to find all the xml files of the pacagke, then something like this can help :

$db = Loader::db();
$schema = Database::getADOSchema();
$sql = $schema->RemoveSchema( $xmlFileName );
$schema->ExecuteSchema();