How to reverse a relationship

If you have questions or if you want to share your opinion about Aware IM post your message on this forum
Post Reply
kklosson
Posts: 1646
Joined: Sun Nov 23, 2008 3:19 pm
Location: Virginia

How to reverse a relationship

Post by kklosson »

In my early AwareIM days, I had some misconceptions. I have a relationship between two objects, one is the owner of the other and it is one to one. I would like to reverse that. How can one do this without breaking the relationship in the production database? Let's say that currently, A is the owner of B and I want B to own A.

My thought is:

Step 1: Add a number attribute in B to represent the ID of A and create a process to populate the ID attribute in B with its child object ID from A to "remember" the relationship).
Step 2: Update to the server and run the process created in Step 1.
Step 3: Remove and recreate the relationship to reverse ownership and create a process to relate B to A by referencing the ID planted in B.
Step 4: Publish to the server (this obviously destroys the existing relationship between A and B) and run the process created in Step 3 to recreate under the new ownership scheme.

Is there possibly an easier way?
V8.8
MySQL, AWS EC2, S3
PDFtk Toolkit
Post Reply