Changing association from one-to-one to many-to-one

0
Hello, if I wanna change an association from one to one to be many to one, do I need to migrate the data before changing it ?
asked
3 answers
1

Hi Khalil,

It depends... I created Entity A and Entity B. Dragged an association From A to B and changed the multiplicity to 1-1. I used a microflow to create objects for A and B and set the association. I verified in my app that everything was working fine.

Then I changed the multiplicity for the A_B association (Many A for one B) and restarted my application. Everything was still in tact. Creating object was still working.

 

If you would want to change it to One A for many B, then you need to create a new association (from Mx 10.3.0 and up, you can reverse the association) and you will lose the data (the association between the objects, not the objects itself).

In any case, backup your database and make sure you can roll back to your initial point. 

answered
2

Hi Khalil Resheq,

 

Its required to migrate, as you might sometimes lose the data.

 

Please see the section of reverse the association section in the below link.

https://docs.mendix.com/refguide/association-member-properties/

 

Hope it helps! 

answered
0

Hi Khalil Resheq,

Yes, you should get your data first and change the association later.

 

Please refer the last 4th line of the screenshot below, you will have your answer.

 

image.png

 

answered