WordPress Plugin Development – Can’t drop database table after plugin deactivation?

Solution:

Use $wpdb->query() instead of dbDelta()

function my_plugin_remove_database() {
     global $wpdb;
     $table_name = $wpdb->prefix . "my_plugin_table";
     $sql = "DROP TABLE IF EXISTS $table_name;";
     $wpdb->query($sql);
     delete_option("my_plugin_db_version");
}

register_deactivation_hook( __FILE__, 'my_plugin_remove_database' );

dbDelta() does not supported DROP TABLE query.