Skip to content

Commit 83f2954

Browse files
authored
Merge pull request #122 from kitloong/feature/mariadb
`level` key check for backward compatibility
2 parents c1632cb + 1af447b commit 83f2954

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/Repositories/Entities/MariaDB/CheckConstraint.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class CheckConstraint
2626
/** @var string */
2727
private $constraintName;
2828

29-
/** @var string */
29+
/** @var string|null */
3030
private $level;
3131

3232
/** @var string */
@@ -44,8 +44,11 @@ public function __construct(stdClass $column)
4444
$this->constraintSchema = $lowerKey['constraint_schema'];
4545
$this->tableName = $lowerKey['table_name'];
4646
$this->constraintName = $lowerKey['constraint_name'];
47-
$this->level = $lowerKey['level'];
48-
$this->checkClause = $lowerKey['check_clause'];
47+
$this->level = null;
48+
if (isset($lowerKey['level'])) {
49+
$this->level = $lowerKey['level'];
50+
}
51+
$this->checkClause = $lowerKey['check_clause'];
4952
}
5053

5154
/**
@@ -91,9 +94,9 @@ public function getConstraintName(): string
9194
/**
9295
* Type of the constraint ('Column' or 'Table'). From MariaDB 10.5.10
9396
*
94-
* @return string
97+
* @return string|null NULL if MariaDB < 10.5.10
9598
*/
96-
public function getLevel(): string
99+
public function getLevel(): ?string
97100
{
98101
return $this->level;
99102
}

0 commit comments

Comments
 (0)