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

4

You can use function db_drop_field()

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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