Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Backup the entire database

Hi,

I am creating a module for backuping my entire database. The problem 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 as PHQL queries ? The point is that I will have to be able to load the database back later on.

Thank you.



46.1k
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.