Skip to content

Commit

Permalink
TASK: Include all workspaces of workspaceChain
Browse files Browse the repository at this point in the history
  • Loading branch information
dlubitz committed Aug 15, 2024
1 parent b24e9da commit 72703df
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public function copyNodeAggregateFromBaseWorkspace(
OriginDimensionSpacePoint $targetOriginDimensionSpacePoint,
): void {
try {
$workspaceChain = [$workspaceName, ...$this->getBaseWorkspaces($workspaceName)];
$workspaceChain = $this->getWorkspaceChain($workspaceName);
foreach ($workspaceChain as $baseWorkspace) {
$affectedRows = $this->dbal->executeStatement(
'INSERT INTO ' . $this->tableNamePrefix . ' (assetid, originalassetid, workspacename, nodeaggregateid, origindimensionspacepoint, origindimensionspacepointhash, propertyname)'
Expand Down Expand Up @@ -319,16 +319,16 @@ public function removeWorkspace(WorkspaceName $workspaceName): void
* @param WorkspaceName $workspaceName
* @return array<WorkspaceName>
*/
public function getBaseWorkspaces(WorkspaceName $workspaceName): array
public function getWorkspaceChain(WorkspaceName $workspaceName): array
{
$baseWorkspaces = $this->dbal->executeQuery(
'WITH RECURSIVE workspaceChain AS ('
. 'SELECT * FROM ' . $this->getWorkspacesTableName() . ' w WHERE w.workspacename = :workspaceName'
. ' UNION'
. ' SELECT w.workspacename, w.baseworkspacename from ' . $this->getWorkspacesTableName() . ' w'
. ' SELECT w.workspacename from ' . $this->getWorkspacesTableName() . ' w'
. ' INNER JOIN workspaceChain ON workspaceChain.baseworkspacename = w.workspacename'
. ' )'
. 'SELECT baseworkspacename FROM workspaceChain WHERE baseworkspacename is not null ;',
. 'SELECT workspacename FROM workspaceChain;',
[
'workspaceName' => $workspaceName->value
]
Expand Down

0 comments on commit 72703df

Please sign in to comment.