Skip to content

Loading…

DBAL-899: Escape table name when update schema #2140

Closed
doctrinebot opened this Issue · 4 comments

2 participants

@doctrinebot

Jira issue originally created by user xguiga:

I have a table called by load and a field called by release, but in MySQL these are reserved names, and should be called inside of ``. In my annotations I use like that:

@ORM\Table(name="load") and
@ORM\Column(name="release", length=15)

These lines work good when use ORM, but when I use schema-tool the `` are ignored and it's generate something like that:

ALTER TABLE load CHANGE version release VARCHAR(60) DEFAULT NULL;

And to MySQL it's wrong, the right statement is:

ALTER TABLE load CHANGE version release VARCHAR(60) DEFAULT NULL;

@doctrinebot

Comment created by @ocramius:

[~xguiga] can you verify if master (dbal+orm) fixes this? There has been some work on this issue.

@doctrinebot

Comment created by @deeky666:

Moved to DBAL, this is unrelated to ORM.

The table quotation issue has been fixed in 2.5/master in commit: 75d35f5

The column quotation issue is weird. There has been a fix in 2.5/master in commit: 5156391 for the OLD column name but according to your example the NEW column name is not quoted. But that is working for ages already.

Can you please verify with the latest master as suggested by [~ocramius] and maybe post the exact generated SQL by the schema tool?

@doctrinebot

Comment created by xguiga:

It was fixed, a lot of index was changed too, but the quotation works!
Thanks...

@doctrinebot

Issue was closed with resolution "Fixed"

@doctrinebot doctrinebot added the Bug label
@beberlei beberlei was assigned by doctrinebot
@doctrinebot doctrinebot added this to the 2.5 milestone
@doctrinebot doctrinebot closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.