Is there a way to check if a column exists in a mySQL DB prior to (or as) the ALTER TABLE ADD coumn_name
statement runs? Sort of an IF column DOES NOT EXIST ALTER TABLE
thing.
I've tried ALTER IGNORE TABLE my_table ADD my_column
but this still throws the error if the column I'm adding already exists.
EDIT: use case is to upgrade a table in an already installed web app-- so to keep things simple, I want to make sure the columns I need exist, and if they don't, add them using ALTER TABLE
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…