Doctrine DBAL
  1. Doctrine DBAL
  2. DBAL-126

schema-tool creates primary keys as unique constraints

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.5
    • Fix Version/s: 2.0.7, 2.1
    • Component/s: None
    • Labels:
      None

      Description

      The schema tool calls AbstractPlatform::getCreateIndexSQL() to create new indexes. When the index is primary, this creates a unique key instead.

        Activity

        arnaud-lb created issue -
        Hide
        Karsten Dambekalns added a comment -

        While the description here is very sparse, I think it is about the following problem.

        When a primary key is to be created for MySQL, the statement generated is

        ADD UNIQUE INDEX PRIMARY ON foo (bar)

        This fails with MySQL stating primary is an invalid name. Since "ADD INDEX" is mapped to "ALTER TABLE" anyway, I just made that

        ALTER TABLE foo ADD PRIMARY KEY (bar)

        which works fine. Also

        DROP INDEX primary ON foo

        doesn't work, unless I quote primary (since it is a reserved word), but there

        ALTER TABLE foo DROP PRIMARY KEY

        seems better as well.

        Show
        Karsten Dambekalns added a comment - While the description here is very sparse, I think it is about the following problem. When a primary key is to be created for MySQL, the statement generated is ADD UNIQUE INDEX PRIMARY ON foo (bar) This fails with MySQL stating primary is an invalid name. Since "ADD INDEX" is mapped to "ALTER TABLE" anyway, I just made that ALTER TABLE foo ADD PRIMARY KEY (bar) which works fine. Also DROP INDEX primary ON foo doesn't work, unless I quote primary (since it is a reserved word), but there ALTER TABLE foo DROP PRIMARY KEY seems better as well.
        Hide
        Benjamin Eberlei added a comment -

        Fixed

        Show
        Benjamin Eberlei added a comment - Fixed
        Benjamin Eberlei made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.0.7 [ 10151 ]
        Fix Version/s 2.1 [ 10068 ]
        Resolution Fixed [ 1 ]
        Benjamin Eberlei made changes -
        Workflow jira [ 12704 ] jira-feedback2 [ 17723 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback2 [ 17723 ] jira-feedback3 [ 20078 ]

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DBAL-126, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            arnaud-lb
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: