2

I need to delete some old columns of existing table. How to do it using hook_update or Is there some other way to delete old columns in .install file .

Thanks

1 Answer 1

5

You can use function db_drop_field()

/**
 * Implements hook_update_N().
 */
function mymodule_update_7001() {
  db_drop_field('my_table', 'my_column');
}
2
  • Could you give an example?
    – rooby
    Commented Apr 16, 2015 at 11:20
  • Yeah, I updated my post
    – Eugene
    Commented Apr 16, 2015 at 11:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.