Re: [Modeling-users] Using modeling framework in long run
Status: Abandoned
Brought to you by:
sbigaret
From: John L. <jl...@gm...> - 2004-07-19 13:30:11
|
On Mon, 19 Jul 2004 00:41:33 +0300, Andrey Lebedev <an...@mi...> wrote: > The simplest procedure I can come up with is: > > 1. Change database on sql server using regular tools > > 2. Change generated files by adding get<attr>, set<attr> methods and > other necessary functions. > > 3. Change model file (actually I'm not sure it is nesessary) > > The procedure is somewhat too complex, expecially because generated > python modules are not elementary and consist of relatively complex > statements to be written by hand each time database schema changes. > > So, the question is: what, generally I have to do when I have, say, > developer and production project installations and I want add new column > to a table? How do you handle such situations? 1. Change model file 2. Regenerate python code, using -B (you must've done this the first time too) The -B option gives you the validators (the business logic) in files in the base directory of the generated package, and set/get/add/etc. (the "pure" generated code that you don't add to). 3. Alter the database. this leaves your python code without the new validators, which you might have to add, but it's significantly less trouble than what you described. If your validators get very complex, you might find it easyer to put them in a mixin class, and modify the generated classes via the mixin (which would normally be just one line per class you need to add). Also, if you keep all the revisions of the original, unmodified generated code, you can update the validators automatically with diff3. -- John Lenton (jl...@gm...) -- Random fortune: bash: fortune: command not found |