On 9/7/06, Seth Remington <[EMAIL PROTECTED]> wrote: > Hello All, > > I am using MiddleKit in an open source application and as most projects > go it is expanding and evolving, and the database structure is evolving > with it. > > So now I have a requirement to provide a convenient upgrade path for > users that includes database schema changes. MiddleKit is wonderful for > doing a fresh install... but not so much for upgrading an existing > install. > > I've researched the archives and wiki and found the references to > mysqldiff. Unfortunately I can't guarantee that other users are going to > be using MySQL so the resulting SQL might not be portable. > > I'm thinking I might have to write something to use the MiddleKit.Design > internals to generate the appropriate SQL for the appropriate database. > But before I delved into that I thought I would ask the community if > anyone has dealt with this situation before, or perhaps a better > suggestion about how to go about it. > > -Seth
Hi Seth, Everytime I've dealt with this situation, I have used mysqldiff, pgdiff or RedGate SQL Compare. So always the same approach, just a different tool depending on the database. You certainly could write a program that would load an old MK model and a current model and then generate the statements to turn the old into the new. Of course, the user will have to ensure that they feed the correct old model that matches their current database-to-be-updated. I feel that could be error prone and/or burdensome which is why I went the "sql schema diff" route. Plus it saves time to leverage them. But if you did write an MK-update utility, it would be along the lines of loading the two models and then enumerating the Klasses and Attrs inside to determine what had to be added, removed or altered. MK models are comprised of objects from the classes seen in MiddleKit/Core/*.py. The code in MiddleKit/Design certainly shows examples of plowing through the contents of a model. And yeah, you would leverage it for any CREATE statements you needed to generate. You'd have to write the ALTERs and removals yourself. If you have more MK questions, feel free. -Chuck ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Webware-discuss mailing list Webware-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/webware-discuss