Skip to content

Commit

Permalink
Fix serialisation of unique index type name (UNIQUE KEY)
Browse files Browse the repository at this point in the history
  • Loading branch information
paranoiq committed Feb 27, 2024
1 parent 7055059 commit a52e714
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sources/Sql/Ddl/Table/Index/IndexType.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class IndexType extends SqlEnum
{

public const PRIMARY = Keyword::PRIMARY . ' ' . Keyword::KEY;
public const UNIQUE = Keyword::UNIQUE . ' ' . Keyword::KEY; // or INDEX
public const UNIQUE = Keyword::UNIQUE . ' ' . Keyword::INDEX;
public const INDEX = Keyword::INDEX; // or KEY
public const FULLTEXT = Keyword::FULLTEXT . ' ' . Keyword::INDEX; // or KEY
public const SPATIAL = Keyword::SPATIAL . ' ' . Keyword::INDEX; // or KEY
Expand All @@ -28,12 +28,12 @@ protected static function validateValue(string &$value): bool
{
// normalize KEY vs INDEX
$value = strtoupper($value);
if ($value === Keyword::UNIQUE . ' ' . Keyword::INDEX) {
if ($value === Keyword::UNIQUE . ' ' . Keyword::KEY) {
$value = self::UNIQUE;
} elseif ($value === Keyword::FULLTEXT . ' ' . Keyword::KEY) {
$value = self::FULLTEXT;
} elseif ($value === Keyword::SPATIAL . ' ' . Keyword::KEY) {
$value = self::FULLTEXT;
$value = self::SPATIAL;
} elseif ($value === Keyword::KEY) {
$value = self::INDEX;
}
Expand Down

0 comments on commit a52e714

Please sign in to comment.