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

BUGFIX: Fix Workspace Metadata upsert #5397

Merged
merged 1 commit into from
Dec 5, 2024

Conversation

bwaidelich
Copy link
Member

adjusts WorkspaceMetadataAndRoleRepository::updateWorkspaceMetadata() so that it does not fail with

Failed to update metadata for workspace "workspace-name" (Content Repository "default"): An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'default-workspace-name' for key 'PRIMARY'

Background:

Doctrine DBAL has no support for "upserts" built-in and the suggested work around had a flaw that lead to the above exception when the incoming data wasn't actually changed (because $affectedRows is 0 in this case). This is fixed simply by issuing a SELECT first

adjusts `WorkspaceMetadataAndRoleRepository::updateWorkspaceMetadata()` so that it does not fail with

> Failed to update metadata for workspace "workspace-name" (Content Repository "default"): An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'default-workspace-name' for key 'PRIMARY'

Background:

Doctrine DBAL has no support for "upserts" built-in and the [suggested work around](doctrine/dbal#1320 (comment)) had a flaw that lead to the above exception when the incoming data wasn't actually changed (because `$affectedRows` is 0 in this case).
This is fixed simply by issuing a `SELECT` first
Copy link
Member

@mhsdesign mhsdesign left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

upserts are funny thanks

@bwaidelich bwaidelich merged commit 30867ac into 9.0 Dec 5, 2024
10 checks passed
@bwaidelich bwaidelich deleted the bugfix/fix-workspace-metadata-upsert branch December 5, 2024 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants