Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.x]: Merging entry types used in single sections still creates duplicate entries #16394

Closed
MoritzLost opened this issue Jan 7, 2025 · 5 comments
Assignees
Labels

Comments

@MoritzLost
Copy link
Contributor

MoritzLost commented Jan 7, 2025

What happened?

Description

We're still seeing the issue described in #16087

We have four entry types used in four single sections. We merge those all into one. In the development environment where we execute the entry-types/merge command, there aren't any problems. But deploying those changes to a different dev environment or the production environment causes additional entries to be created. All the single sections that used one of the entry types that was merged into another one end up with two entries, one existing and one newly created.

Steps to reproduce

  1. Update a Craft 4 site with at least one Channel and one Single section with similar entry types to Craft 5.
  2. Run entry-types/merge on the two entry types and merge the entry type used by the Single section into the entry type used by the Channel section.
  3. Deploy those changes to a different environment.

Craft CMS version

5.5.7

PHP version

8.3

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

@MoritzLost MoritzLost added the bug label Jan 7, 2025
@MoritzLost MoritzLost changed the title [5.x]: Merging entry types used in single sections still create duplicate entries [5.x]: Merging entry types used in single sections still creates duplicate entries Jan 7, 2025
@i-just
Copy link
Contributor

i-just commented Jan 8, 2025

Hi, thanks for getting in touch! I’m having trouble replicating it. To start with, could you please clarify which entry type you are persisting during the merge - the one used by the single or by the channel? Also, when you deploy the changes, are you deploying both the v5 upgrade and entry type merge in one go, or do you do two deployments? What’s the v4 version you’re upgrading from?

@MoritzLost
Copy link
Contributor Author

MoritzLost commented Jan 8, 2025

To start with, could you please clarify which entry type you are persisting during the merge - the one used by the single or by the channel?

@i-just I'm persisting the entry type that's used in the channel. That's our page entry type used for regular content pages. In Craft 4 we had a couple of single sections that had the exact same fields, but needed to be singles for various reasons. In Craft 5, we want to consolidate the redundant entry types of those singles into the page entry type that's used in a pages section.

Also, when you deploy the changes, are you deploying both the v5 upgrade and entry type merge in one go, or do you do two deployments?

We're deploying those separately. Deploying those all at once lead to problems, when converted Super Table fields were merged in the same step. Our Craft 5 update process is relatively involved, because various things need to happen in distinct steps. We create five separate pull requests:

  1. Update to latest Craft 4.x, update all other dependencies to latest possible version.
  2. Replace plugins that we want to replace in Craft 5, most notably Typed Link → Hyper and Redactor → CKEditor.
  3. Update to latest Craft 5.x, update all plugins to the latest Craft 5.x compatible versions. Also update all templates and modules for Craft 5.
  4. Convert all Super Table fields to Matrix fields and uninstall Super Table.
  5. Clean up and consolidate all the redundant fields and entry types created by the Craft 5 migration. This is where we run fields/merge and entry-types/merge repeatedly.

We create chained pull requests for every step, then merge them one by one, deploying each change to the production server before moving to the next.

What’s the v4 version you’re upgrading from?

Latest 4.x that's available at the time we start with the updates. Might not be the very latest patch version (since the updates take some time), but close. In this case, we updated from 4.13.6 to 5.5.6 (then updated to 5.5.7 in step 5).

@i-just
Copy link
Contributor

i-just commented Jan 9, 2025

Thanks! That helps.

@i-just
Copy link
Contributor

i-just commented Jan 9, 2025

I was able to reproduce and I raised a PR for this. Thanks again for the additional details!

@brandonkelly
Copy link
Member

Craft 5.5.10 is out with that fix. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants