Skip to content

Commit

Permalink
Merge pull request #122 from kitloong/feature/mariadb
Browse files Browse the repository at this point in the history
`level` key check for backward compatibility
  • Loading branch information
kitloong authored Oct 1, 2022
2 parents c1632cb + 1af447b commit 83f2954
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/Repositories/Entities/MariaDB/CheckConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class CheckConstraint
/** @var string */
private $constraintName;

/** @var string */
/** @var string|null */
private $level;

/** @var string */
Expand All @@ -44,8 +44,11 @@ public function __construct(stdClass $column)
$this->constraintSchema = $lowerKey['constraint_schema'];
$this->tableName = $lowerKey['table_name'];
$this->constraintName = $lowerKey['constraint_name'];
$this->level = $lowerKey['level'];
$this->checkClause = $lowerKey['check_clause'];
$this->level = null;
if (isset($lowerKey['level'])) {
$this->level = $lowerKey['level'];
}
$this->checkClause = $lowerKey['check_clause'];
}

/**
Expand Down Expand Up @@ -91,9 +94,9 @@ public function getConstraintName(): string
/**
* Type of the constraint ('Column' or 'Table'). From MariaDB 10.5.10
*
* @return string
* @return string|null NULL if MariaDB < 10.5.10
*/
public function getLevel(): string
public function getLevel(): ?string
{
return $this->level;
}
Expand Down

0 comments on commit 83f2954

Please sign in to comment.