Jira issue originally created by user emilw:
doctrine orm:convert-mapping --from-database yml /tmp/test.yml
I get presented an error
Invalid index-name tablename"input"_idx given, has to be [a-zA-Z0-9]
The index "type" is quoted because this is a reserved word in Postgres. for example see the following definition:
FOREIGN KEY (something) REFERENCES somethings(id) ON UPDATE CASCADE
FOREIGN KEY (another) REFERENCES anothers(id) ON UPDATE CASCADE
FOREIGN KEY ("type") REFERENCES logtypes(id) ON UPDATE CASCADE
Only type will be quoted because it is a reserved word.
Comment created by @beberlei:
You have to quote with `` in Doctrine. That is translated to the underyling vendor quotation signs.
Comment created by emilw:
@benjamin this considers a mapping error from database (Postgres) to YAML through the doctrine commandline tool, I do not think your comment is relevant for this issue.
@Emil it is, are you quoting the reserved word in the YML file using `` ? DBAL has some logic to fix escaping in these cases.
@benjamin uhm, I might be baffled with the complexity of Doctrine or just plain wrong. But I'm trying to create a YML file from my database. How can I be making a mistake in the YML file with quotes?
The error message is presented because the Dcotrine ORM module tries to generate index names on columns, based on the database schema, but fails because the returned names (from the database schema) contain quotes (because they are reserved words).
Sorry, now i get it. I didnt relaize the usecase you were applying. Yes you are right :-)
Can you give me an Example Postgresql Schema with DDL SQL that produces this error?
These are the table creation for a test table which is able to reproduce the error.
I hope this is enough information. The attached SQL reproduces the following error:
Invalid index-name something"input"_idx given, has to be [a-zA-Z0-9]
orm:convert-mapping [--filter="..."] [--from-database] [--extend[="..."]] [--num-spaces[="..."]] -h -q -v -V -a -n command to-type dest-path
I can't reproduce it :-(
Can you run the command with --verbose ? Additionally in lib/Doctrine/ORM/Tools/Console/Command/ConvertMappingCommand.php can you var_dump() $metadata after line 119?
Ok i could reproduce it now. Input is not a keyword for me though, type also not. Coudl reproduce it with "table"
Ok, this is a DBAL issue.
This is fixed and will be included in 2.0.2
Issue was closed with resolution "Fixed"
Imported 1 attachments from Jira into https://gist.github.com/08b7125e315cae2bea35