Skip to content

[5.x]: Some singles are duplicated when the underlying entry type is merged #16087

@MoritzLost

Description

@MoritzLost

What happened?

Description

We updated one of our sites from Craft 4 to Craft 5. After the update, we merged some redundant entry types. After deploying the change with those merges, we ended up with duplicates of some of the single entries:

Image

The sections 404 Seite, Datenschutz and Impressum are all singles. In Craft 4, those all had their own entry type with identical settings. In Craft 5, we merged those three entry types into a generic page entry type.

I'm pretty confident the entry type merge is responsible, since all other singles that didn't have their entry type merged weren't duplicated. So it looks like there's a bug that causes Craft to create a new entry type in a single section when the entry types that's used in this section is merged with another one. This issue only happened when merging the update into production, not in the local dev environment.

In addition to fixing this behaviour, I need some guidance on how to clean up those duplicated entries. I can't delete them through the CP since that's not possible for singles. I'll need to nuke those entries directly in the DB, but I'm worried I will leave behind a broken state.

Steps to reproduce

See above.

Expected behavior

There should never be more than one entry associated with a section. Merging the entry type used in a single should not cause the single to be duplicated.

Actual behavior

Upon deploying the changes that contain the merged entry types, an additional entry was created for each single whose entry type was merged. Now we have two redundant entries both associated with the same single.

Craft CMS version

5.4.10

PHP version

8.3

Operating system and version

No response

Database type and version

MySQL 8

Image driver and version

No response

Installed plugins and versions

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions