5use Doctrine\DBAL\Platforms\AbstractPlatform;
6use Doctrine\DBAL\Types\Type;
7use InvalidArgumentException;
19 public const ENUM =
'mwenum';
31 if ( $platform->getName() ==
'sqlite' ) {
39 if ( $platform->getName() ==
'postgresql' ) {
40 if ( !$column[
'fixed'] ) {
44 return strtoupper( $column[
'name'] .
'_enum' );
47 if ( $platform->getName() ==
'mysql' ) {
48 $enumValues = $this->
formatValues( $column[
'enum_values'] );
49 return "ENUM( $enumValues )";
64 if ( $platform->getName() !==
'postgresql' ) {
65 throw new InvalidArgumentException(
66 __METHOD__ .
' can only be called on Postgres platform'
70 $enumName = strtoupper( $column[
'name'] .
'_enum' );
71 $enumValues = $this->
formatValues( $column[
'enum_values'] );
72 $typeSql =
"\n\nCREATE TYPE $enumName AS ENUM( $enumValues )";
84 $values = implode(
"','", $values );
85 $enumValues =
"'" . $values .
"'";