We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Change table structure and model

Hi! This can be a simple question. I have my tables set up and my models generated. Now I think I need a few more columns. What is the best way to make my model class reflect the new columns in my table? Should I delete the model class and regenerate it or there is a more elegant way to do that? Thanks in advance.

I would suggest making a 'merge' as if it were a VCS.

So change the structure without losing changes, validadiones, etc.



816

And this merge would be just to add the new (extra) properties to the model class? Or should I do something more?

tries to make an investigation of like having functionality merge files, tools and share how to how to improve this part.

  • add/remove properties
  • add/remove getters and setters
  • change map column
  • etc...

This is somewhat complicated by the different configurations, the easiest way is to generate the whole model and replace. But if you can do, it would be a plus point Phalcon tool.



816

Ok! I'll figure out the best way and I'll share it! Thanks, Edwin!