Restore File Documents to PostgreSQL database

1
Hello, I need to be able to use the data, including files, from my production environment on my local app. I followed these instructions in order to restore the cloud database to a local PostgreSQL database, but when I try to retrieve the files within the app I receive the error "File download failed! The file '(filename)' could not be found." Is there any way to accomplish this?   Thanks,   Steven
asked
3 answers
6

Steven,

From the Download Backup window, download the Uploaded Files as below:

You now have a .tar.gz file

I use 7-Zip to expand this file into a tar file - there are many other tools you can use to do this.

Now, from the Modeler, from the Project menu, select Show Project Directory In Explorer

This will take you to a directory that looks like this:

Open the deployment directory, then open the data directory, then open the files directory.

If there is anything in the files directory, delete it.

Once the files directory is empty, navigate back to the location of your *.tar file.  Use 7-Zip, or the tool of your choice, to extract the contents of that tar file into the files directory that you just emptied out.

After this is done, you will see many subfolders in the files directory - these contain your documents.

One Important Note:  make sure you download the Uploaded Files from the same download that you restored into Postgres.  Otherwise you'll have a mismatch between the files and the database. 

Hope that helps,

Mike

answered
4

Mendix documents aren't actually stored within the database itself. Instead, the database contains pointers to actual documents on the file system.

In order to restore your files, make sure you download the files or the full backup as suggested in the article. The documents are all in folders with names like 2a, 4d, etc. Copy these folders to:

<your project directory>/deployment/data/files/

 

That should do the trick!

answered
1

Or automate it :)

 

https://github.com/appronto/scripts

 

 

answered