diff --git a/Neos.ContentRepositoryRegistry/Classes/Service/EventMigrationService.php b/Neos.ContentRepositoryRegistry/Classes/Service/EventMigrationService.php index c2b7b5b6ebd..c917634e799 100644 --- a/Neos.ContentRepositoryRegistry/Classes/Service/EventMigrationService.php +++ b/Neos.ContentRepositoryRegistry/Classes/Service/EventMigrationService.php @@ -389,7 +389,7 @@ public function migratePayloadToValidWorkspaceNames(\Closure $outputFn): void UPDATE {$eventTableName} SET payload = JSON_SET( - payload, + payload, '$.workspaceName', IF(JSON_UNQUOTE(JSON_EXTRACT(payload, '$.workspaceName')) REGEXP '^[a-z0-9][a-z0-9\-]{0,35}$', LOWER(JSON_UNQUOTE(JSON_EXTRACT(payload, '$.workspaceName'))), @@ -406,7 +406,7 @@ public function migratePayloadToValidWorkspaceNames(\Closure $outputFn): void UPDATE {$eventTableName} SET payload = JSON_SET( - payload, + payload, '$.baseWorkspaceName', IF(JSON_UNQUOTE(JSON_EXTRACT(payload, '$.baseWorkspaceName')) REGEXP '^[a-z0-9][a-z0-9\-]{0,35}$', LOWER(JSON_UNQUOTE(JSON_EXTRACT(payload, '$.baseWorkspaceName'))), @@ -418,9 +418,43 @@ public function migratePayloadToValidWorkspaceNames(\Closure $outputFn): void AND BINARY JSON_UNQUOTE(JSON_EXTRACT(payload, '$.baseWorkspaceName')) NOT REGEXP '^[a-z0-9][a-z0-9\-]{0,35}$' SQL; $affectedRowsBaseWorkspaceName = $this->connection->executeStatement($statementBaseWorkspaceName); + + $sourceWorkspaceNameStatement = <<connection->executeStatement($sourceWorkspaceNameStatement); + + $targetWorkspaceNameStatement = <<connection->executeStatement($targetWorkspaceNameStatement); $this->connection->commit(); - if ($affectedRowsWorkspaceName === 0 && $affectedRowsBaseWorkspaceName === 0) { + if ($affectedRowsWorkspaceName === 0 && $affectedRowsBaseWorkspaceName === 0 && $sourceWorkspaceAffectedRows === 0 && $targetWorkspaceAffectedRows === 0) { $outputFn('Migration was not necessary.'); return; } @@ -428,6 +462,8 @@ public function migratePayloadToValidWorkspaceNames(\Closure $outputFn): void $outputFn(); $outputFn(sprintf('Migration applied to %s events and changed the workspaceName.', $affectedRowsWorkspaceName)); $outputFn(sprintf('Migration applied to %s events and changed the baseWorkspaceName.', $affectedRowsBaseWorkspaceName)); + $outputFn(sprintf('Migration applied to %s events and changed the sourceWorkspaceName.', $sourceWorkspaceAffectedRows)); + $outputFn(sprintf('Migration applied to %s events and changed the targetWorkspaceName.', $targetWorkspaceAffectedRows)); $outputFn(sprintf('You need to replay your projection for workspaces. Please run: ./flow cr:projectionreplay --projection=workspace')); }