XF 1.5 Need to restore a couple of members from a backup

Stuart Wright

Well-known member
Two accounts have been accidentally deleted from the live XF 1.5 system. We have daily backups.
Is there a query (or queries) I can run on the backup database to extract all the user data I need for the specific user IDs and insert that back into the live database?
What tables do I need to restore?
Fingers crossed there is a way to do this.
 

AndyB

Well-known member
Assuming these accounts have many posts, you would need to restore from your most recent backup. Also keep in mind associated attachments will also have to be restored.
 

Kirby

Well-known member
It is of course possible to selectively restore deleted data (like user accounts), but it is complicated, does take quite some time and requires expert knowledge about the data structures.

Basically you have to perform two series of queries:

1) Restore deleted rows
SQL:
INSERT INTO live.table (SELECT * FROM backup.table WHERE <condition>)
2) Re-Link Data
SQL:
UPDATE backup.table AS backuptable INNER JOIN live.table AS livetable ON (<joincondition>) SET livetable.<field> = backuptable.<field>;
The exact queries depend on your installation (Add-ons, Setting, etc.) - nobody you can tell you those without exactly knowing your system.
 

Xon

Well-known member
There are some ~42 odd tables which need updating/restoring. I've got some scripts which dump from an old database and then patch into the live database, and trigger indexing for the various content for that user.

It is fairly involved due to the amount of customization which can vary from forum to forum
 
Top