maybe this is a noob-question, but I need to know this. I think I’m just getting better in cake. But I try to completely plan my db structure. But this isn’t possible in all cases, so I wanted to know, what to do when I extend my already baked application by modifing the db structure or by adding new models which have relations to already baked models.
Case 1 - Modifing DB after bake
When I alter the db by adding/renaming a column, then only the model changes (except test-classes). Right?
So when I add a field, i have nothing to add in the models, except the validators, right? All object-properties of the model (representing) the database are available automatically. So only the Table-File is being touched.
Case 2 - Adding tables with relations to baked models
When I add new tables which should be associated to already baked models, I only have to define the association in the corresponding table files.
The other files files, which are already baked have not to be touched.
Am I missing something, or did I get this correctly? Please fulfill my explanations if neccessary.
Thanks in advance!
In the long run, you would be better off forgetting about bake and write every line of code yourself. Not to say a copy and paste is fine sometimes. I tryed bake, it takes longer fixing than it would me just type the code in. But again I am old school, Used to weld with 7018 rod, and from the have to work to earn a living era. And I have a habit of giving very straight to the point answers to questions. Maybe a hypnosis could make you forget you ever heard the word cakebake.
Maybe or maybe not.
But this doesn’t answer the question. Even if I would code everything myself not using bake, I have to know, what to do in these cases above to extend the app properly.
I hope you know what I mean.
This question is just a general question. Maybe I explained everything correctly, or I did forget something to mention. But I want to be sure if I’m extending my app the “correct way”.
Yes, it is something like that in most of the cases, except you have some really special thing in your models.
Perhaps views can change if you added / renamed db fields.
Thank you for the answer. For views, it is clear, that they may change. But I wouldn’t believe, that extending/alering is that simple regarding models.