Skip to content

Commit

Permalink
allow option to migrate workspaces and external schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
pivnicek committed Dec 3, 2024
1 parent 694b5e4 commit 57ceaf7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,4 +203,14 @@ public function isSourceByodb(): bool
{
return (bool) $this->getValue(['parameters', 'isSourceByodb']);
}

public function getIncludedWorkspaceSchemas(): array
{
return $this->getArrayValue(['parameters', 'includeWorkspaceSchemas']);
}

public function getIncludedExternalSchemas(): array
{
return $this->getArrayValue(['parameters', 'includeExternalSchemas']);
}
}
2 changes: 2 additions & 0 deletions src/Configuration/ConfigDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ protected function getParametersDefinition(): ArrayNodeDefinition
->scalarNode('sourceByodb')->end()
->scalarNode('sourceKbcUrl')->isRequired()->cannotBeEmpty()->end()
->scalarNode('#sourceKbcToken')->isRequired()->cannotBeEmpty()->end()
->arrayNode('includeWorkspaceSchemas')->prototype('scalar')->end()->end()
->arrayNode('includeExternalSchemas')->prototype('scalar')->end()->end()
->arrayNode('tables')->prototype('scalar')->end()->end()
->arrayNode('db')
->children()
Expand Down
8 changes: 6 additions & 2 deletions src/Strategy/DatabaseMigrate.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,15 @@ public function migrate(Config $config): void
if (in_array($schemaName, self::SKIP_CLONE_SCHEMAS, true)) {
continue;
}
if (str_starts_with($schemaName, 'WORKSPACE')) {
if (str_starts_with($schemaName, 'WORKSPACE')
&& !in_array($schemaName, $config->getIncludedWorkspaceSchemas())) {

continue;
}

if (!$this->sourceSapiClient->bucketExists($schemaName)) {
if (!$this->sourceSapiClient->bucketExists($schemaName)
&& !in_array($schemaName, $config->getIncludedExternalSchemas())) {

continue;
}

Expand Down

0 comments on commit 57ceaf7

Please sign in to comment.