Hi Pankaj,
Yes, it is possible to migrate the documents without using Mendix Runtime, but I would not recommend directly reading the Mendix database tables and extracting the binary data unless you fully understand the database structure.
A System.FileDocument is the Mendix system entity used for storing files, and its file content is binary data. Mendix also supports binary attributes directly in the database, although for most file scenarios Mendix recommends using a FileDocument association.
For a migration, I would suggest this approach:
FileDocument records, including metadata such as:If you still have access to the Mendix application, a safer migration approach is to expose/retrieve the files through Mendix rather than querying the internal database directly. Mendix supports retrieving FileDocument content through REST and storing the binary response as a file.
Also, depending on the deployment architecture, don't assume that the document binary is necessarily stored in the MSSQL database. For example, current Mendix environments can use separate blob/file storage for System.FileDocument contents.
So before writing SQL queries, Expose as REST API and Use in Non Mendix Application.
Kindly mark this as the accepted answer if it helps.
Hi Pankaj,
One important point here is that the FileDocument metadata and the actual file content are not necessarily stored in the same place.
For a normal Mendix System.FileDocument (or a specialization of it), the FileDocument object and its metadata are stored in the relational database, but the actual binary file content is managed by Mendix's File Storage. Mendix documents this separately from the relational database storage.
So if your application is using System.FileDocument, querying the MSSQL database alone will generally not give you the actual PDF/Word/image contents.
The migration needs to consider two parts:
MSSQL
├── FileDocument metadata
├── Business records
└── Associations between them
File Storage
└── Actual file contents
├── PDF
├── DOCX
├── Images
└── etc.
The association between your business entity and the FileDocument is stored in the Mendix database, so that association is what you use to map a document back to its business record.
For example:
Customer
|
+-- Document (FileDocument)
|
+-- Invoice.pdf
I would not recommend copying the Mendix database tables directly into the target application.
Instead, migrate the data as two related datasets:
For example, create a migration mapping such as:
Mendix Document ID Business Record ID File Name File Size Content Type Storage File
and use the Mendix Document ID as the temporary migration key.
It is possible to perform a migration without calling Mendix microflows, provided you have direct access to both the MSSQL database and the underlying file storage.
However, I would avoid relying on undocumented Mendix internal tables or constructing file paths from database IDs. The exact storage implementation can depend on the deployment/storage configuration, and those internal details are not a supported external integration contract.
For example, in a containerized/private-cloud setup, Mendix can use external blob storage such as S3, Azure Blob Storage, MinIO, or other supported storage options, rather than storing the files in MSSQL.
If this is a database-to-database migration between Mendix applications, there is also another important consideration: Mendix states that you cannot simply copy data from one Mendix app's database to another because entity identifiers are app-specific. For that scenario, Mendix recommends using the Database Replication module rather than copying the tables directly.
So the first thing I would establish is where the current environment stores its FileDocument contents. Once that is known, the migration can be designed as:
MSSQL ↓ Export business data + FileDocument metadata ↓ Preserve Document ID / association mapping ↓ Export files from Mendix File Storage ↓ Transform ↓ Target application's DB + file storage
I would not rely on a SQL query against the MSSQL database alone to retrieve the actual FileDocument binary content unless the application is specifically using a Binary attribute instead of System.FileDocument. Mendix documents Binary attributes as being stored in the database, whereas FileDocument content is handled through file storage.
Hope this helps.