diff --git a/src/Phinx/Db/Adapter/MysqlAdapter.php b/src/Phinx/Db/Adapter/MysqlAdapter.php index f983dfbcc..e5f4cba78 100644 --- a/src/Phinx/Db/Adapter/MysqlAdapter.php +++ b/src/Phinx/Db/Adapter/MysqlAdapter.php @@ -1362,7 +1362,10 @@ protected function getColumnSqlDefinition(Column $column): string $def .= $column->getEncoding() ? ' CHARACTER SET ' . $column->getEncoding() : ''; $def .= $column->getCollation() ? ' COLLATE ' . $column->getCollation() : ''; $def .= !$column->isSigned() && isset($this->signedColumnTypes[$column->getType()]) ? ' unsigned' : ''; - $def .= $column->isNull() ? ' NULL' : ' NOT NULL'; + + if (!($column->getType() instanceof Literal) || strpos($this->getConnection()->getAttribute(PDO::ATTR_SERVER_VERSION), 'MariaDB') === false) { + $def .= $column->isNull() ? ' NULL' : ' NOT NULL'; + } if ( version_compare($this->getAttribute(\PDO::ATTR_SERVER_VERSION), '8', '>=')