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); 开发者_Go百科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');
}
}
精彩评论