Jira issue originally created by user zyxist:
It seems that Doctrine ORM tries to generate invalid unique index names, when the table name is quoted and one of the columns uses the "unique" annotation:
* @var string $login
* @Column(name="login", type="string", length=40, unique=true)
The table gets created.
Creating database schema...
Invalid index-name "User"*login_uniq given, has to be [a-zA-Z0-9*]
0. Doctrine\DBAL\Schema\SchemaException::indexNameInvalid on line 214
1. Doctrine\DBAL\Schema\Table::_createIndex on line 176
2. Doctrine\DBAL\Schema\Table::addUniqueIndex on line 341
3. Doctrine\ORM\Tools\SchemaTool::_gatherColumn on line 273
4. Doctrine\ORM\Tools\SchemaTool::_gatherColumns on line 193
5. Doctrine\ORM\Tools\SchemaTool::getSchemaFromMetadata on line 93
6. Doctrine\ORM\Tools\SchemaTool::getCreateSchemaSql on line 76
7. Doctrine\ORM\Tools\SchemaTool::createSchema on line 73
8. Doctrine\ORM\Tools\Console\Command\SchemaTool\CreateCommand::executeSchemaCommand on line 59
9. Doctrine\ORM\Tools\Console\Command\SchemaTool\AbstractCommand::execute on line 159
10. Symfony\Component\Console\Command\Command::run on line 205
11. Symfony\Component\Console\Application::doRun on line 117
12. Symfony\Component\Console\Application::run on line 72
I don't know whether the problem is caused by ORM which forgets that the table names can be quoted, or by DBAL for the same reason. Anyway, I think this should be fixed. I agree with your argumentation that identifier quoting can be wrong, but you should also remember that Doctrine can be used in cooperation with other ORM libraries or with legacy databases. I am in this particular situation: the database is shared by two different systems written in two different languages and using two different ORM libraries, and this is a big limitation for me.
Comment created by @beberlei:
Why do you need SchemaTool if you have a legacy database?
You can use @Table(uniqueConstraints=...) to specify the index name, this circumvents your problem http://www.doctrine-project.org/projects/orm/2.0/docs/reference/annotations-reference/en#ann_table
This issue has a simple workaround and no possible sane solution undoing the quoting.
Issue was closed with resolution "Won't Fix"