Skip to content

Commit

Permalink
Merge pull request #101 from fritzmg/patch-1
Browse files Browse the repository at this point in the history
Skip migration if field does not exist
  • Loading branch information
doishub authored May 29, 2024
2 parents 278f328 + 6a6a76c commit afd5227
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/StyleManager/Sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Contao\System;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Exception;
use Doctrine\DBAL\Schema\Column;
use DOMDocument;
use DOMElement;
use DOMNode;
Expand Down Expand Up @@ -58,6 +59,14 @@ public function shouldRunObjectConversion($table = null): bool
return false;
}

$columnNames = array_map(static function (Column $column): string {
return $column->getName();
}, $schemaManager->listTableColumns($table));

if (!\in_array('styleManager', $columnNames, true)) {
return false;
}

$objConfig = $this->connection->fetchFirstColumn("SELECT styleManager FROM " . $table . " WHERE styleManager IS NOT NULL");
$archives = StyleManagerArchiveModel::countAll();

Expand Down

0 comments on commit afd5227

Please sign in to comment.