diff --git a/src/Propel/Generator/Platform/MysqlPlatform.php b/src/Propel/Generator/Platform/MysqlPlatform.php index 674da5667..2815b909f 100644 --- a/src/Propel/Generator/Platform/MysqlPlatform.php +++ b/src/Propel/Generator/Platform/MysqlPlatform.php @@ -464,10 +464,6 @@ public function getColumnDDL(Column $col): string if ($def && $def->isExpression()) { throw new EngineException('DATE columns cannot have default *expressions* in MySQL.'); } - } elseif ($sqlType === 'TEXT' || $sqlType === 'BLOB') { - if ($domain->getDefaultValue()) { - throw new EngineException('BLOB and TEXT columns cannot have DEFAULT values. in MySQL.'); - } } $ddl = [$this->quoteIdentifier($col->getName())]; diff --git a/src/Propel/Generator/Reverse/MysqlSchemaParser.php b/src/Propel/Generator/Reverse/MysqlSchemaParser.php index 0e1350739..1b24730b5 100644 --- a/src/Propel/Generator/Reverse/MysqlSchemaParser.php +++ b/src/Propel/Generator/Reverse/MysqlSchemaParser.php @@ -262,7 +262,14 @@ public function getColumnFromRow(array $row, Table $table): Column } // BLOBs can't have any default values in MySQL - $default = preg_match('~blob|text~', $nativeType) ? null : $row['Default']; + + $default = $row['Default']; + if ($default !== null) { + if (preg_match('~blob|text~', $nativeType)) { + // mariadb has extra single quotes on TEXT type default values, but not on other types + $default = preg_replace('@^\'(.*)\'$@', '$1', $row['Default']); + } + } $propelType = $this->getMappedPropelType($nativeType); if (!$propelType) {