1 of 2
sp00m
  • 47.6k
  • 1
  • 13
  • 15

Yet another "why was this question closed"

MySQL is missing DROP COLUMN IF EXISTS.

This question is asking "what the syntax for it". The official response is "there is none" (accepted answer), but there are workarounds (other answers).

I think I found a better approach that has not been proposed yet, so I wanted to post it as an answer to help other developers, but the question has been closed as off-topic.

How shall I proceed?

FYI, I basically created a reusable procedure that allows you to write call drop_column_if_exists('the_table_name', 'the_column_name');. Not revolutionary, but definitely helps.

sp00m
  • 47.6k
  • 1
  • 13
  • 15