Moving file uploads into the database

<< Click to Display Table of Contents >>

Navigation:  » No topics above this level«

Moving file uploads into the database


By default, Bizagi projects store file uploads into a file server.

Whenever customers need to move file uploads of existing cases, so that these get stored inside the Bizagi database (and no longer in a physical path), you may rely on the use of the File migrator tool.


Use cases

The File migrator tool is a desktop executable application provided by Bizagi Ltd, which will move all files from a given physical path and into a Bizagi database; either set in Microsoft Azure or set in an on-premises instance.

The main use case for this scenario is whenever a customer wants to migrate an on-premises project to Bizagi PaaS (and therefore, has the need to have file uploads comply to Bizagi PaaS architecture and storage characteristics).


The main objective of this tool, as considered in this document, is to provide the means for the Bizagi Cloud Operations team so that the team can consider all the relevant aspects of a migration of a customer's environment to the cloud and perform such tasks smoothly.



This document is for internal use only (Bizagi employees), and it is classified as a restricted document.




At the moment, the tool has a known issue which doesn't support files considered in these version-11 features:

Inheritance in data modeling (files uploaded in such option for cases, are not moved into the database).

Therefore, only if a project does not rely on any of the features above, it will be smoothly and completely eligible to use the tool in order to move out files into the database.

Otherwise, contact the Bizagi support team beforehand.



Before you start

Consider that this tool does not elaborate, nor strictly emphasizes on all the steps required by the Bizagi Services team, nor required by the Bizagi Cloud Operations team whenever a customer needs to migrate its project to the cloud.

This procedure is purely about migrating the file uploads.

Also, while this procedure is applicable to any Bizagi environment, consider that file uploads are usually important only in staging or production environments.


The procedure described below, parts from already having the following:


1.  The customer's database backup restored into a supported SQL Server instance.

The SQL Server instance can be either part of an SQL Azure service or an on-premises setup (this decision is up to the Bizagi Cloud Operations team, according to the team's standards, policies and procedures).  


From such restored database, you will need access while having at hand the following information:

The database server and instance, referred to as <DATA_SOURCE>.

The name for the restored database, referred to as <DATABASE>.

Login account to access it, referred to as <USERNAME>.

The password for that login account, referred to as <PASSWORD>.




2.  A directory with all the file uploads from that customer's environment.

Notice that such directory should be compliant to Bizagi's files structure (as managed in its default Docs folder), and it will be referred to as <DOCS_PATH> from this point on:




Technical requirements

The File migrator tool requires the use of:

.Net framework version 4.5.2 or higher.

Online connectivity to the target database (this tool may be used in a machine of Cloud Operation's choice as long as it meets with the requirements).

No records whatsoever at a specific database table of Bizagi's meta-model, which is the BAFILECONT table.


You may verify that the BAFILECONT table in the target database is empty by running the following query:

select count(1) from BAFILECONT




The result of the execution of this query must be equal to zero (otherwise it may imply that files uploaded through Bizagi are already stored in the database).


Records having NULL values for the caseAttachFile column, along with having a value equal to 1 for the storage column, both at the BACASEATTACHMENT table of the Bizagi's meta-model.


Similarly, you may verify that such values comply to the above,  running the following query:






Download and install the tool

In order to use the tool, follow these steps:


1. Download it from Bizagi website.


2. Unzip the downloaded file in a local path of your choice.

Such path will be referred to as <TOOL_HOME> from this point on:





In order to use the tool, follow these steps:


1. Run a command prompt with administrator rights.




2. Browse into <TOOL_HOME> (the path where you unzipped the tool).




3. Execute the following command:


FileAttributeMigrator.exe FileToDB ConnectionString="Data Source=<DATA_SOURCE>;Initial Catalog=<DATABASE>;Persist Security Info=True;User ID=<USERNAME>;Password=<PASSWORD>" UploadPath="<DOCS_PATH>"




Consider replacing the corresponding values for the variables above that determine access to the target database (<DATA_SOURCE>, <DATABASE>, <USERNAME>, <PASSWORD>).


Once the command is run, the tool will display the number of files it has migrated, and the number of files which were not migrated (failed to do so).

You may review the log found at <TOOL_HOME> for further detail.




Once finished, run iisreset.



Once that the procedure is finished, you may verify that file uploads are now stored inside of the Bizagi database, by running the following queries:

1. select * from BAFILECONT




Notice that this time, the result of the executed query should display the same number of rows displayed after the tool execution.


2. select * from BACASEATTACHMENT




Notice that this time, the result of the executed query should not display NULL values for caseAttachFile field and all the value for the storage field must be 2.