Doctrine DBAL
  1. Doctrine DBAL
  2. DBAL-916

Some alter table statements do not respect @Table name value

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.4
    • Fix Version/s: None
    • Component/s: Schema Managers
    • Security Level: All
    • Labels:
      None
    • Environment:
      MacOS

      Description

      I have specified the table name for each class generating a table. I find that some table names are respected during doctrine update upon the database, and some are not.

      Specifically it seems that simpler entities, one's annotated with entity/table become lower case, while more complicated ones (inheritance map) respect the given table name.

        Activity

        Hide
        Julia Smith added a comment -

        On further inspection, this does not appear to be a bug with Doctrine. A simple dump of the update statements generated shows no table name change, but:

        ALTER TABLE Comment DROP FOREIGN KEY FK_5BC96BF03DBEAF48;
        DROP INDEX IDX_5BC96BF03DBEAF48 ON Comment;
        ALTER TABLE Comment CHANGE replyto_id replytox_id INT DEFAULT NULL;
        ALTER TABLE Comment ADD CONSTRAINT FK_5BC96BF0484A4D29 FOREIGN KEY (replytox_id) REFERENCES Comment (id);
        CREATE INDEX IDX_5BC96BF0484A4D29 ON Comment (replytox_id);

        Somehow causes mysql to change the case of the table on MacOS.

        weird.

        Show
        Julia Smith added a comment - On further inspection, this does not appear to be a bug with Doctrine. A simple dump of the update statements generated shows no table name change, but: ALTER TABLE Comment DROP FOREIGN KEY FK_5BC96BF03DBEAF48; DROP INDEX IDX_5BC96BF03DBEAF48 ON Comment; ALTER TABLE Comment CHANGE replyto_id replytox_id INT DEFAULT NULL; ALTER TABLE Comment ADD CONSTRAINT FK_5BC96BF0484A4D29 FOREIGN KEY (replytox_id) REFERENCES Comment (id); CREATE INDEX IDX_5BC96BF0484A4D29 ON Comment (replytox_id); Somehow causes mysql to change the case of the table on MacOS. weird.
        Hide
        Steve Müller added a comment -

        Julia Smith can you please provide more details concerning your actual problem? I'm not sure I understand what the problem is here. I can't see how the SQL you pointed out changes a table's name in any way so I don't understand how that could change the table name's case.
        Concerning identifier casing in general I would suggest you to read the following from the MySQL documentation:
        http://dev.mysql.com/doc/refman/5.5/en/identifier-case-sensitivity.html

        And a pretty good explanation of the problem with identifiers and case accross operating systems and database vendors:
        http://www.alberton.info/dbms_identifiers_and_case_sensitivity.html#.U47DV3IZWlM

        If the casing of identifiers (table names, column names etc.) in your schema is important for you, you will either have to quote those in your mapping explicitly or use a custom quoting strategy. Please refer to the documentation for further details:
        http://docs.doctrine-project.org/en/latest/reference/basic-mapping.html#quoting-reserved-words

        Hope that helps.

        Show
        Steve Müller added a comment - Julia Smith can you please provide more details concerning your actual problem? I'm not sure I understand what the problem is here. I can't see how the SQL you pointed out changes a table's name in any way so I don't understand how that could change the table name's case. Concerning identifier casing in general I would suggest you to read the following from the MySQL documentation: http://dev.mysql.com/doc/refman/5.5/en/identifier-case-sensitivity.html And a pretty good explanation of the problem with identifiers and case accross operating systems and database vendors: http://www.alberton.info/dbms_identifiers_and_case_sensitivity.html#.U47DV3IZWlM If the casing of identifiers (table names, column names etc.) in your schema is important for you, you will either have to quote those in your mapping explicitly or use a custom quoting strategy. Please refer to the documentation for further details: http://docs.doctrine-project.org/en/latest/reference/basic-mapping.html#quoting-reserved-words Hope that helps.

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Julia Smith
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: