diff --git a/core/attributedef.class.inc.php b/core/attributedef.class.inc.php index 428d7acc8e..2dc9665e32 100644 --- a/core/attributedef.class.inc.php +++ b/core/attributedef.class.inc.php @@ -2656,6 +2656,22 @@ class AttributeEnum extends AttributeString return "VARCHAR(255)".($bFullSpec ? " DEFAULT ''" : ""); // ENUM() is not an allowed syntax! } } + + protected function GetSQLColSpec() + { + $default = $this->ScalarToSQL($this->GetDefaultValue()); + if (is_null($default)) + { + $sRet = ''; + } + else + { + // ENUMs values are strings so the default value must be a string as well, + // otherwise MySQL interprets the number as the zero-based index of the value in the list (i.e. the nth value in the list) + $sRet = " DEFAULT ".CMDBSource::Quote($default); + } + return $sRet; + } public function ScalarToSQL($value) {