I’ve yet to have the experience to draw a method or procedures to use Yii when your schema is changing across time.
My boss says that the schema will evolve with time rather often so I need to either reproduce the Model files code on each schema changes (using Gii), or, do something else.
Manual editing of Model classes to match the changes in the DB is the least desired option since its time consuming and mostly - error prone.
OTOH, automatic code generation is also not suitable since… mind my inexperience, according to tutorials/documentation I’m supposed to have lots of (biz logic) code in the model files and regeneration of Model classes will drop that to the trash bin.
So, what would be your recommendations on working in such environment?
Don’t tell me to tell the DBA to fixate the DB schema. As much as we all want this - it won’t happen, even if strongly desired (and it is).
I guess I’ll need to research a bit about Giix to learn why I cannot do this double level of inheritance by myself, and… well I’ve seen enough links to giix to justify short acquittance with it in any case.
The only reason i can see, why someone would like to recreate their models after a schema change are the validation rules (maybe also relations). I would never trust any machine that creates these rules for me. So to me this is always a matter of manual interaction.
True… it’s easier to just check the generated code… but that regards only the first time you create the table when there are many fields…
if you just add one or two fields to the table… IMO is much faster to just add the necessary code for those fields manually… rules, label names, and form inputs…