I need to run an installer which can also be an updater.
The installer needs to be able to end up having a certain scheme/structure of the mysql database, regardless if some of the tables existed, missed a few columns, or need not to be changed because their structure is up to date.
How can I make an elegant combination of ALTER
and CREATE
?
I was thinking there must be something like "ADD... IF... Duplicate"
Say I have table A. In one client the table has one column -A1, and another client has the same table but with column A1 and column A2.
I want my sql command to make both clients' table A hold three columns : A1, A2, and A3.
Again, my script is a sql file that I dump to mysql.
How do I do it? Thanks :-)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…