Topic: Backup and Restore

The Backup and Restore function works on the database.
So what happens to attached documents? Are these saved in the database as well (as blobs)? If that is the case the no problem. On the other hand, if such documents are not saved in the database, then one has to backup the company folder as well. These are located in fa/company/xx where xx is a number starting at  0, 1, 2, etc.

Now I am assuming that the attachments are left in the folder fa/company/xx/attachments. And that the table xx_attachments only points to this location.

So let's say I have been backing up my companies on a regular basis and writing my backups to DVD for quite some time. What happens when a company is deleted? The folder of the company is changed. sad

Now all my backups point to the wrong folder. Sometimes it happens that I want to go back six months or even a year. Restoring old backups may ruin current companies.

My suggestion: For each and every new company create a new database. (see my other post elsewhere for modifying fa to do just that). But most importantly, create the company in a folder with the same name as the database. This way, all company details remain the same, throughout the lifetime of the company.

Also, when deleting a company, make sure to delete the folder AND drop the database.

What say you?

Re: Backup and Restore

Attachments are not stored in database but in company/x/attachments folder. This is done this way due to the size of document files. Single pdf file attached easily can have several MB. Storing them in database would render the backup files unusable in short time.
When you delete company, all the company/x folder is deleted, together with all attachments file. In fact deleting company means you do not want to use the company data anymore. If this is not the case you have to do both database and attachments folder backup. before company deletion.

Janusz

Re: Backup and Restore

itronics wrote:

When you delete company, all the company/x folder is deleted, together with all attachments file. In fact deleting company means you do not want to use the company data anymore. If this is not the case you have to do both database and attachments folder backup. before company deletion.

Janusz

The problem is not with deleting the folder company/x the real problem lies in that after deleting the company, all companies that were created after the deleted company will get a different folder. This will render any previously made folder backups useless.

Is it possible to have the companies stay with their folder for the lifetime of the company?

Thanks

Re: Backup and Restore

I see. No, the folder numbers are related to company index in $db_connections in company_db.php, so if you delete any company the folders are shifted. You can't rely on the company/X folder name. If you want to have completely independent companies you should install one source tree per company under separate www folders.

Janusz

Re: Backup and Restore

Janusz, may I suggest a change?
If the company folders get the same name as the table_prefix then there won't be any need to rename the folders after deleting a company.

Carmelo

Re: Backup and Restore

I can't remember why this is implemented this way, but I'm nearly sure this was long considered and finaly right decision.  This is really no fun from writing code more complex than needed. Now there is too late for this change - keep in mind we have to provide minimal backward compatibilty with older FA versions. Having spare time I would like to spent it on implementing full backup/restore feature including also attachment files instead of improving maybe not ideal folder numbering scheme wink.
Janusz