Data Migration between entities in different modules.

Hi experts, I would like to move the whole entity ’A’ in module ‘α’ to module ’b’ with data. What would be the best practice for the data migration between  different modules.   I understand there is a way to use microflow to transfer the data, but I am being skeptical with implementing the  ‘migration function’ in the production level product. Any ideas’ welcome and I really appreciate it. Addition : We are monitoring the entity a from different system and do not want the name to be changed.   Thank you in advance, Regards, Yuki AIBE
2 answers

If your sole purpose is to move entity x from module A to module B (as in: no other structural changes, just reorganizing modules): the easiest way is to right-click the entity in Studio Pro, select “Move to” and select the target module. 


This step can be repeated for any entity that needs to be moved, in this case Mendix will just rename the table and no data migration is needed. You will need to re-select the allowed roles, and any logic/microflows would need to be moved manually as well.


If you need to keep the original data and/or have structural changes, the best way is indeed to create a new, separate entity in the other module and write a microflow that retrieves all objects for the original entity and creates new ones for the new entity. Keep in mind that:

  1. It is advisable to have a submicroflow to either retrieve or create the object in the new module based on a unique key. If you run the microflow twice on the same (production) environment you don’t want to end up with duplicate data!
  2. If your entity contains a lot of data, you will want to break up the retrieval in multiple steps. If you fetch 100000 objects in a single microflow you could run out of Java heap space (memory) in which case the server will crash and restart...

Hi, first you create the entity in your module B, then you create a microflow to convert the data from entity a to entity b, then you test and deploy your application and run the microflow, when all was well transfered to entity B, you can remove the entity A and the data from it.