doctrine / orm

Doctrine Object Relational Mapper (ORM)
https://www.doctrine-project.org/projects/orm.html
MIT License
9.94k stars 2.52k forks source link

Support mysql unique index column name NULL #11696

Open emrebas1 opened 4 weeks ago

emrebas1 commented 4 weeks ago

Bug Report

Q A
Version 2.19.5

Summary

MYSQL define NULL column names for conditional unique constraint

example

when I run orm:schema-tool:update command I get the following error

Error thrown while running command "orm:schema-tool:update". Message: "Doctrine\DBAL\Schema\Index::_addColumn(): Argument #1 ($column) must be of type string, null given, called in /doctrine/dbal/src/Schema/Index.php on line 72" ["exception" => TypeError { …},"command" => "orm:schema-tool:update","message" => "Doctrine\DBAL\Schema\Index::_addColumn(): Argument #1 ($column) must be of type string, null given, called in /doctrine/dbal/src/Schema/Index.php on line 72"]

Current behavior

_addColumn method expects string

Expected behavior

it should allow null

How to reproduce

CREATE UNIQUE INDEX UNIQUE_IDX_example ON example_table (column1, (case when column2 is null then -1 else column2 end))

orm:schema-tool:update