Skip to content

Commit

Permalink
Add missing empty string check
Browse files Browse the repository at this point in the history
  • Loading branch information
kitsunet committed Dec 1, 2024
1 parent 3448e21 commit 5abdb0a
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ final protected function resetDatabase(Connection $connection, ContentRepository
$connection->prepare($preDeleteStatement)->executeStatement();
}

$truncateDropStatement = match (true) {
$truncateOrDropStatement = match (true) {
$connection->getDatabasePlatform() instanceof PostgreSQLPlatform => '%s TABLE `%s` CASCADE',
default => '%s TABLE `%s`',
};
Expand All @@ -145,7 +145,7 @@ final protected function resetDatabase(Connection $connection, ContentRepository
continue;
}
// truncate is faster
$sql = sprintf($truncateDropStatement, $keepSchema ? 'TRUNCATE' : 'DROP', $tableName);
$sql = sprintf($truncateOrDropStatement, $keepSchema ? 'TRUNCATE' : 'DROP', $tableName);
$connection->prepare($sql)->executeStatement();
}

Expand All @@ -154,7 +154,9 @@ final protected function resetDatabase(Connection $connection, ContentRepository
default => '',
};

$connection->prepare($postDeleteStatement)->executeStatement();
if ($postDeleteStatement !== '') {
$connection->prepare($postDeleteStatement)->executeStatement();
}
}

final protected function subscriptionStatus(string $subscriptionId): ProjectionSubscriptionStatus|DetachedSubscriptionStatus|null
Expand Down

0 comments on commit 5abdb0a

Please sign in to comment.