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

Backup the entire database

Hi,

I am creating a module for backing up my entire database. The thing is I would like to use PHQL or any other means allowing my code to work for any db engine.

How would you suggest I do it ? Does Phalcon offer any tools for perhaps listing all tables and saving them with PHQL queries ? The point is that I will have to be able to load the database back later on.

Thank you.



79.0k
Accepted
answer
edited Sep '16

ORM is designed to interact with a database in OOP way, tasks such as database dump are not on that list. You can do it, since ORM keeps info about your table structure (i.e. metadata), and with methods such as find() you can get the entire result set from database. BUT, that would lead to many issues with memory at first place, so at the end of the day just use database dump tools as it is much more efficient for such use case.