Skip to content

Commit

Permalink
Merge branch '4.x' into issue-803
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Jan 16, 2025
2 parents 2be55a0 + 9cf0a3c commit d2154b6
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/View/Helper/MigrationHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,17 +236,21 @@ public function constraints(TableSchemaInterface|string $table): array
if ($tableConstraints[0] === 'primary') {
unset($tableConstraints[0]);
}
if (!empty($tableConstraints)) {
foreach ($tableConstraints as $name) {
$constraint = $tableSchema->getConstraint($name);
if ($constraint && isset($constraint['update'])) {
$constraint['update'] = $this->formatConstraintAction($constraint['update']);
}
if ($constraint && isset($constraint['delete'])) {
$constraint['delete'] = $this->formatConstraintAction($constraint['delete']);
}
$constraints[$name] = $constraint;
foreach ($tableConstraints as $name) {
$constraint = $tableSchema->getConstraint($name);
if (!$constraint) {
continue;
}
if ($constraint['type'] === 'primary') {
continue;
}
if (isset($constraint['update'])) {
$constraint['update'] = $this->formatConstraintAction($constraint['update']);
}
if (isset($constraint['delete'])) {
$constraint['delete'] = $this->formatConstraintAction($constraint['delete']);
}
$constraints[$name] = $constraint;
}

return $constraints;
Expand Down

0 comments on commit d2154b6

Please sign in to comment.