What is the proper way to drop a table using hook_update_N? I can't find docs on this. If I run update_sql($sql); in my hook--the sql being a drop statement--it reports a failure, even though checking the db, I can see that the table was dropped.
You should be able to use db_drop_table()
(or the Drupal 6 version here).
You can do it in hook_update_N
/**
* Drop 'my_table' table.
*/
function MYMODULE_update_7001() {
if (db_table_exists('my_table')) {
db_drop_table('my_table');
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With