Refresh database

Looked at great example https://github.com/phalcon/tutorial-models-init I've got a question: Is there any way to refresh database (create, alter tables, etc) by models definitions, like $connection->updateDatabase()? Or only way is using createTable, alterTable functions (http://docs.phalconphp.com/en/latest/reference/db.html#creating-tables) with manual check for diff?



83.4k

There is no an automatic way to do that, but I think the migrations code on devtools could be reused to implement something similar to the idea you have.

https://github.com/phalcon/phalcon-devtools/tree/master/scripts/Phalcon/Mvc/Model