Skip Navigation

[Resolved] Duplicates after executing relationship migration

This thread is resolved. Here is a description of the problem and solution.

Problem: After running the relationships migration process, I see some duplicate posts and translations.

Solution: Make sure the intermediary posts are translatable, and also marked as translations of each other.

This support ticket is created 5 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 15 replies, has 3 voices.

Last updated by q1 5 years, 8 months ago.

Assisted by: Christian Cox.

Author
Posts
#914670

q1
Screen Shot 2018-06-18 at 11.49.57.png

Hi,

I recently updated WordPress, all the plugins and also Types from 2.1 to 3.0.1.

Everything seems to work as it should so I started the relationship migration under Toolset -> Settings. Afterwards I noticed that some (oddly not all) relationships are now duplicated shown in the relationship box when editing a post.

Here's the excerpt of the relationship migration log

...
> Unable to migrate an association from post #0 to #6919 to a relationship "exhibition_partnership": Unable to load posts 0 (0).
> Unable to migrate an association from post #0 to #6920 to a relationship "exhibition_partnership": Unable to load posts 0 (0).
> Unable to migrate an association from post #0 to #6922 to a relationship "exhibition_partnership": Unable to load posts 0 (0).
> Connected #6596 (Leit an der Stad) and #6934 (partnership 6934) in the relationship "exhibition_partnership".
> Connected #6597 (Leit an der Stad) and #6942 (partnership 6942) in the relationship "exhibition_partnership".
> Connected #6592 (Leit an der Stad) and #6943 (partnership 6943) in the relationship "exhibition_partnership".
...
> Connected #6940 (Photothèque de la XYZ) and #6934 (partnership 6934) in the relationship "partner_partnership".
> Connected #6936 (Photothèque de la XYZ) and #6942 (partnership 6942) in the relationship "partner_partnership".
> Connected #6941 (Photothèque de la XYZ) and #6943 (partnership 6943) in the relationship "partner_partnership".
...

I attached a screenshot which displays the issue in a post. When I click on all 3 "partnership xxxx" to edit them I get the same post (id 6941) loaded.

I couldn't find any existing tickets which relates to this issue. So I am really confused.

I have a theory that it could be related to the WPML plugin. I have DE, EN and FR (default) set up. It seems that the partnership post had not been created in the default language but in DE. Unfortunately I can't find a pattern and also not the code which could lead to this issue, so it is still just a theory.

I have this issue also on another site.

Thanks for your help!

#914948

Hi, I'll be glad to take a look. Do you have a backup from before you performed the migration? I would like to run the same migration process locally and review the results. I will activate a private reply field here where you can provide a download link to a Duplicator package or a database SQL dump file.

#915413
Screen Shot 2018-06-19 at 12.36.04 PM.png

Can you tell me which settings you chose in the relationship migration process? I'm attaching a screenshot here for your reference. Please let me know the settings you chose for the pictured options. You can disregard the Custom legacy code checkbox for now.

#915619

q1

I will try, since I don't exactly recall. But I think I checked "Change the translation..." and chose the option "Automatically create draft...." with "Copy entire content from original..."

For this site I got this log

> Post relationships migration started.
> Maintenance mode enabled.
> No tables had to be dropped.
> The toolset_associations, toolset_relationships and toolset_post_type_sets tables have been created.
> Adjusted the translation mode of the post type "page" to "display as translated".
> Relationship "page_slideritem" between post types "page" and "slideritem" was created.
> Adjusted the translation mode of the post type "exhibition" to "display as translated".
> Relationship "exhibition_sponsoring" between post types "exhibition" and "sponsoring" was created.
> Relationship "exhibition_host" between post types "exhibition" and "host" was created.
> Relationship "exhibition_partnership" between post types "exhibition" and "partnership" was created.
> Relationship "exhibition_linked-event" between post types "exhibition" and "linked-event" was created.
> Relationship "exhibition_slideritem" between post types "exhibition" and "slideritem" was created.
> Adjusted the translation mode of the post type "event" to "display as translated".
> Relationship "event_sponsoring" between post types "event" and "sponsoring" was created.
> Relationship "event_host" between post types "event" and "host" was created.
> Relationship "event_partnership" between post types "event" and "partnership" was created.
> Relationship "event_linked-event" between post types "event" and "linked-event" was created.
> Relationship "event_slideritem" between post types "event" and "slideritem" was created.
> Adjusted the translation mode of the post type "collection" to "display as translated".
> Relationship "collection_sponsoring" between post types "collection" and "sponsoring" was created.
> Relationship "collection_host" between post types "collection" and "host" was created.
> Relationship "collection_partnership" between post types "collection" and "partnership" was created.
> Relationship "collection_slideritem" between post types "collection" and "slideritem" was created.
> Adjusted the translation mode of the post type "sponsor" to "display as translated".
> Relationship "sponsor_sponsoring" between post types "sponsor" and "sponsoring" was created.
> Adjusted the translation mode of the post type "organizer" to "display as translated".
> Relationship "organizer_host" between post types "organizer" and "host" was created.
> Adjusted the translation mode of the post type "partner" to "display as translated".
> Relationship "partner_partnership" between post types "partner" and "partnership" was created.
> Adjusted the translation mode of the post type "news" to "display as translated".
> Relationship "news_slideritem" between post types "news" and "slideritem" was created.
> Relationship definitions migrated.
...

And for the other site I got this log

> Post relationships migration started.
> Maintenance mode enabled.
> No tables had to be dropped.
> The toolset_associations, toolset_relationships and toolset_post_type_sets tables have been created.
> The post type "page" has a "show only translated items" translation mode but no adjustments are made as per user's choice.
> Relationship "page_slideritem" between post types "page" and "slideritem" was created.
> The post type "exhibition" has a "show only translated items" translation mode but no adjustments are made as per user's choice.
> Relationship "exhibition_sponsoring" between post types "exhibition" and "sponsoring" was created.
> The post type "exhibition" has a "show only translated items" translation mode but no adjustments are made as per user's choice.
> Relationship "exhibition_host" between post types "exhibition" and "host" was created.
> The post type "exhibition" has a "show only translated items" translation mode but no adjustments are made as per user's choice.
> Relationship "exhibition_partnership" between post types "exhibition" and "partnership" was created.
> The post type "exhibition" has a "show only translated items" translation mode but no adjustments are made as per user's choice.
> Relationship "exhibition_linked-event" between post types "exhibition" and "linked-event" was created.
> The post type "exhibition" has a "show only translated items" translation mode but no adjustments are made as per user's choice.
> Relationship "exhibition_slideritem" between post types "exhibition" and "slideritem" was created.
> The post type "event" has a "show only translated items" translation mode but no adjustments are made as per user's choice.
> Relationship "event_sponsoring" between post types "event" and "sponsoring" was created.
> The post type "event" has a "show only translated items" translation mode but no adjustments are made as per user's choice.
> Relationship "event_host" between post types "event" and "host" was created.
> The post type "event" has a "show only translated items" translation mode but no adjustments are made as per user's choice.
> Relationship "event_partnership" between post types "event" and "partnership" was created.
> The post type "event" has a "show only translated items" translation mode but no adjustments are made as per user's choice.
> Relationship "event_linked-event" between post types "event" and "linked-event" was created.
> The post type "event" has a "show only translated items" translation mode but no adjustments are made as per user's choice.
> Relationship "event_slideritem" between post types "event" and "slideritem" was created.
> The post type "collection" has a "show only translated items" translation mode but no adjustments are made as per user's choice.
> Relationship "collection_sponsoring" between post types "collection" and "sponsoring" was created.
> The post type "collection" has a "show only translated items" translation mode but no adjustments are made as per user's choice.
> Relationship "collection_host" between post types "collection" and "host" was created.
> The post type "collection" has a "show only translated items" translation mode but no adjustments are made as per user's choice.
> Relationship "collection_partnership" between post types "collection" and "partnership" was created.
> The post type "collection" has a "show only translated items" translation mode but no adjustments are made as per user's choice.
> Relationship "collection_slideritem" between post types "collection" and "slideritem" was created.
> The post type "sponsor" has a "show only translated items" translation mode but no adjustments are made as per user's choice.
> Relationship "sponsor_sponsoring" between post types "sponsor" and "sponsoring" was created.
> The post type "organizer" has a "show only translated items" translation mode but no adjustments are made as per user's choice.
> Relationship "organizer_host" between post types "organizer" and "host" was created.
> The post type "partner" has a "show only translated items" translation mode but no adjustments are made as per user's choice.
> Relationship "partner_partnership" between post types "partner" and "partnership" was created.
> The post type "news" has a "show only translated items" translation mode but no adjustments are made as per user's choice.
> Relationship "news_slideritem" between post types "news" and "slideritem" was created.
> Relationship definitions migrated.
...

Maybe these log are helpful.

#915852

Okay thank you, I have escalated the problem to my 2nd tier support team and provided the database copy. Can you explain a bit more about these logs you posted?
- Are these from 3 different sites? I'm not clear because neither log contains the message you posted first.
- Are you experiencing similar duplication issues in all 3 sites?

#915863

q1

Sorry to be not clear. I will try it again.

There are two sites, one is the one linked to this thread and the other is a site which is similar to the linked one.

The first and second excerpts are from the linked site. The third excerpt is from the similar site.

First excerpt only refers to the part of the mentioned post relation which was definitely not correct.

Second and third excerpts are the first line of the migration log. I added those for completeness since I thought it could be helpful.

And yes, both sites seem to have the same issues.

I hope that it is more understandable now.

#915947

Thanks for the clarification, I will keep you updated here.

#916184

q1

Hi,

sorry for asking but do you perhaps know when a solution would be available? I am asking because I will need to make the updates in the next two weeks.

If it takes longer then I won't execute the relations migration update and only update WordPress an the plugins.

#916218

I do not have a timeline available for the resolution just yet, I am working with my team leader to reproduce the problem reliably in his test environment so he can continue investigation. I'll update you as soon as possible.

#922168

Hi, just a quick update to let you know this issue has been escalated to our developers for more detailed analysis. I will keep you posted here as I receive additional information.

#922351

q1

Hi, thanks a lot for the information update 🙂

#1095160

After in-depth analysis from the developers, I have some information to share. The short answer is everything seems to be behaving as intended, given the state of your website before the relationships migration. The reason there appear to be duplicates has to do with the fact that the Partnership posts were not marked as translatable. Here is a more detailed technical explanation from our developer:

-------------------------------------------------
I'm going to use the specific example of post #6936 ("Photothèque de la Ville de Luxembourg", FR language).

The post has two translations with the same name, that together make this translation set:

#6936 ("Photothèque de la Ville de Luxembourg", FR language)
#6940 ("Photothèque de la Ville de Luxembourg", EN language)
#6941 ("Photothèque de la Ville de Luxembourg", DE language)
Each of those posts is connected via (legacy) post relationship to a different post of the partnership type:

#6936 --> partnership 6942
#6940 --> partnership 6934
#6941 --> partnership 6943
The partnership post type is NOT translatable, so each of the partnership posts is seen as a completely separate element.

This whole situation is possible because of the fact that the legacy implementation didn't care about post translations, it sees every post separately.

Now, imagine that we perform the migration.

The new implementation behaves differently: Practically speaking, we no longer connect posts, but translation sets. This has to do with the fact that we store associations only between posts of the default language ID (of course, all this is true only for translatable posts).

When migrating, all existing connections to posts that are part of a translation set (all our "partner" posts from this example) are now connected to the translation set as a whole.

That means, the translation set (#6936, #6940, #6941) now has following associations:

(#6936, #6940, #6941) --> partnership 6942
(#6936, #6940, #6941) --> partnership 6934
(#6936, #6940, #6941) --> partnership 6943

The situation would have been different if these "partnership" posts were also translations of each other, in that case, the migration would produce a single association:

(#6936, #6940, #6941) --> (#6942, #6934, #6943)
So, the conclusion is that everything behaves as supposed to, but the site's design is not optimal. The "partnership" posts should be translatable and correctly linked before running the migration.
------------------------

So it looks like there is no bug to resolve here. Let me know if you have any follow-up questions and I will be happy to relay to the developers if necessary.

#1098408

q1

Hi,

thanks for the detailed explanation.

I understand the part where the CPT "partnerships" should be set as translatable.

But I don't understand why the CPT "partnerships" isn't correctly linked? The CPT "partnerships" acts as intermediate 'table' to relate a multi-relationship between other CPTs.

What do I need to do in order to correct the linking problem?

#1098807

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

Christian is currently on a public holiday today but he will be back tomorrow to continue helping here.

Thanks,
Shane

#1099634

The Partnership posts must be translatable, and the 3 Partnership posts that represent different language instances of the same relationship should be marked as translations of each other, in the correct languages. For example Partnership #6942 is the default FR language Partnership to the Partner "Photothèque de la Ville de Luxembourg". Partnership #6934 should be set as the English translation of #6942, and #6943 should be set as the DE translation of #6942. This creates one translation set that will be migrated collectively.

This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.