On Tue, 25 Jun 2002, Michael Robbins wrote: >I'm looking for a utility that can compare two database structures and >generate a SQL statement that will duplicate the differences. > >I'm using mySQL and I have both live and development databases. While >working on the development database, I frequently make changes to table >structures, adding/removing tables or columns, changing column types, or >adding/removing indexes. > >When I'm ready to move my changes to the live site, I'd like to just >compare the two databases, and have it generate a SQL statement that I >can run on my live database, so that it's structure will match my >development database. This would be much easier than trying to make all >of the changes manually, or writing my own script to make the changes >(how would you test this? Can't test it on the development database, the >changes are already there. Can't test it on the live database, what if >there's a mistake of some kind?)
Do a diff on the two tables descriptions. mysql -uuser -ppass database1 -e 'desc sometable' > sometable1 && mysql -uuser -ppass database2 -e 'desc sometable' > sometable2 && diff sometable1 sometable2 > difference cat difference -- ----------------------------------------------------------------------- Greg Donald http://destiney.com/public.key ----------------------------------------------------------------------- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php