Skip to content

Commit

Permalink
fix: skip DBs with read-only schema
Browse files Browse the repository at this point in the history
  • Loading branch information
leon0399 committed Oct 23, 2024
1 parent 434b08b commit 4ee2140
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Migrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Cycle\Database\DatabaseInterface;
use Cycle\Database\DatabaseManager;
use Cycle\Database\DatabaseProviderInterface;
use Cycle\Database\Driver\ReadonlyHandler;
use Cycle\Database\Table;
use Cycle\Migrations\Config\MigrationConfig;
use Cycle\Migrations\Exception\MigrationException;
Expand Down Expand Up @@ -316,7 +317,10 @@ protected function getMigrationCreatedAtForDb(MigrationInterface $migration): \D
private function getDatabases(): iterable
{
if ($this->dbal instanceof DatabaseManager) {
return $this->dbal->getDatabases();
return array_filter(
$this->dbal->getDatabases(),
fn(DatabaseInterface $db): bool => !$db->getDriver()->getSchemaHandler() instanceof ReadonlyHandler
);
}
return [];
}
Expand Down

0 comments on commit 4ee2140

Please sign in to comment.