|No such thing as a small change|
Generating ALTER TABLE code for MySQLby blogical (Pilgrim)
|on Oct 21, 2006 at 05:25 UTC||Need Help??|
blogical has asked for the
wisdom of the Perl Monks concerning the following question:
Not necessarily perl, but I'm currently headed towards a perlish solution...
I have two databases, one for development and another for production. They do not share the same data. When I make structural changes in development, I need to apply them to production when I update.
As I am unaware of any native MySQL function combination that addresses this specific need I've begun to think about a perlsih solution.
My current solution is to dump the table structure creation sql, apply some alterations to translate CREATE statements into ALTER / CHANGE statements, and apply that as a patch. This has a few limitations- it doesn't drop leftover columns or keys, and it doesn't create missing columns. While this seems to suit my purposes, I thought I would ask around and see if anyone has seen a similar / better solution.
"One is enough. If you are acquainted with the principle, what do you care for the myriad instances and applications?"