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

Fix migration to avoid duplicate collection slugs and names #2318

Merged
merged 9 commits into from
Jan 21, 2025

Conversation

ikreymer
Copy link
Member

Follow-up to #2301

Updates the 0039 migration to ensure collection slugs and names are unique by:

  • Removing all indexes
  • Setting slug to random value
  • Adding unique index to slug field.
  • Attempting to set slug from name using slug_from_name()
  • If rejected due to duplicate, append -<counter> at end of slug. Also update name with <counter>.
  • Now that names should also be unique, add unique index on name field.

…ugs:

- add unique slug index as part of migration
- if duplicate slug detected, increment suffix until valid slug is found
- also add suffix to original name, as names should also be unique
- add unique name index as part of migration

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
fix
@ikreymer ikreymer requested a review from tw4l January 18, 2025 01:10
Co-authored-by: Tessa Walsh <tessa@bitarchivist.net>
@ikreymer ikreymer requested a review from tw4l January 21, 2025 21:25
@ikreymer ikreymer merged commit 28d39d8 into main Jan 21, 2025
22 checks passed
@ikreymer ikreymer deleted the migration-avoid-dupe-coll-slugs branch January 21, 2025 22:23
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

Successfully merging this pull request may close these issues.

None yet

2 participants