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]: Some singles are duplicated when the underlying entry type is merged #16087

Closed
MoritzLost opened this issue Nov 12, 2024 · 7 comments
Closed
Assignees
Labels

Comments

@MoritzLost
Copy link
Contributor

MoritzLost commented Nov 12, 2024

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

@MoritzLost MoritzLost added the bug label Nov 12, 2024
@i-just i-just self-assigned this Nov 12, 2024
@brandonkelly
Copy link
Member

Any chance you can share your Craft 4 database, as well as your Craft 5 Composer files, so we can try to reproduce on our end? If so please send them to [email protected].

@MoritzLost
Copy link
Contributor Author

@brandonkelly Done! Let me know if you need any other information or files.

@brandonkelly
Copy link
Member

Nevermind, we’ve been able to reproduce. We’ll look into it.

@brandonkelly
Copy link
Member

Craft 5.5.1 is out with a fix for this. Thanks for reporting!

@MoritzLost
Copy link
Contributor Author

@brandonkelly Thanks for fixing this!

I got one production site where the duplication glitch already happened, could you advise me on the best way to delete the superfluous single entries? Probably going to remove those from the database manually? I'm worried about leaving junk or accidentally deleting something that belongs to the existing singles …

@brandonkelly
Copy link
Member

You could switch the section to a Channel, deploy, delete the extra entry, and then switch it back to a Single.

@MoritzLost
Copy link
Contributor Author

@brandonkelly Good idea, thanks! I ended up cheating a bit – switched the production environment to dev mode for a minute, changed the sections to channels, deleted the additional entries, then reset and applied the config again. Worked like a charm 🙂

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