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

Duplicating Entry Doesn't Create a Unique UID #4653

Closed
TonyDeStefano opened this issue Jul 25, 2019 · 6 comments
Closed

Duplicating Entry Doesn't Create a Unique UID #4653

TonyDeStefano opened this issue Jul 25, 2019 · 6 comments

Comments

@TonyDeStefano
Copy link
Contributor

Description

When you select an Entry and choose "Duplicate" from the action menu, it creates a new entry with the same UID.

Steps to reproduce

  1. Create an entry
  2. Check the box next to the entry
  3. Choose "Duplicate"

This query shows current duplicates in the database:

SELECT uid, count(*) AS `count` 
FROM elements 
GROUP BY uid 
HAVING `count` > 1

Additional info

  • Craft version: 3.1.34.2
  • PHP version: 7.2.11
@TonyDeStefano
Copy link
Contributor Author

"Save as New Entry" does the same thing. We end up with two elements that have the same UID.

@brandonkelly
Copy link
Member

I had noticed this bug during 3.2 development, but thought it was limited to 3.2 alpha releases, so while 3.2 has a migration to fix duplicate UIDs, it only runs if you’re coming from 3.2.0-alpha.6 or later.

So I just added a new console command that you will be able to run once Craft 3.2.8 is released, which will run the same migration code.

./craft utils/fix-element-uids

To get the fix early, change your craftcms/cms requirement in composer.json to:

"require": {
  "craftcms/cms": "dev-develop#0e0c89e4684e07d784a1e4d5bdcaa3395ee07a54 as 3.2.7",
  "...": "..."
}

Then run composer update.

@TonyDeStefano
Copy link
Contributor Author

We are unable to upgrade to 3.2 right now. I submitted a PR for 3.1.

@brandonkelly
Copy link
Member

brandonkelly commented Jul 25, 2019

We aren’t releasing additional 3.1 releases. You’ll just have to point composer.json to your fork with the fix, until you are ready to update to 3.2.

@ryanpcmcquen
Copy link

@brandonkelly, this is a critical bug, hopefully you'll reconsider implementing some fix for this on 3.1.

@brandonkelly
Copy link
Member

Craft 3.1 isn’t an LTS release. As said you are welcome to use a fork with your own fix until you’re ready to update to 3.2.

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

No branches or pull requests

3 participants