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

Generate Database Tables from Models

I know it's possible to auto-generate .php files for models by creating tables in the database first. Is it also possible to do it the other way around? So that I can create a model.php file and update my database accordingly so that it creates the table for the model together with its columns?

This works, for example, in doctrine, where you define your models metadata (in a .yml file for example) and then it creates the necessary SQL statements to update the database.

Could you please explain exactly how I do this? I've read that page and watched the video but I can't figure out how to do it. How do I declare which Columns my Table should have and which type they are etc. ?

Long time ago since this discussion started, I'm looking after the same functionality. I have written some models and I want to replicate its structure to my database. Is it possible?