Doctrine 1
  1. Doctrine 1
  2. DC-768

Renaming a NOT NULL column without a default value fails in MySQL migrations

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.2
    • Fix Version/s: None
    • Component/s: Migrations
    • Labels:
      None

      Description

      When trying to rename a column that is NOT NULL and has no default value, Doctrine generates this SQL:

      ALTER TABLE `article` CHANGE `typeid` `listid` INT DEFAULT NULL NOT NULL

      Which fails. It should be:

      ALTER TABLE `article` CHANGE `typeid` `listid` INT NOT NULL

        Activity

        Jack Sleight created issue -
        Jack Sleight made changes -
        Field Original Value New Value
        Description When trying to rename a column that is NOT NULL and has no default value, Doctrine generates this SQL:

        {code}ALTER TABLE `article` CHANGE `typeid` `listid` INT DEFAULT NULL NOT NULL{code}

        Which fails. It should be:

        {code}ALTER TABLE `at_article` CHANGE `journalid` `listid` INT NOT NULL{code}
        When trying to rename a column that is NOT NULL and has no default value, Doctrine generates this SQL:

        {code}ALTER TABLE `article` CHANGE `typeid` `listid` INT DEFAULT NULL NOT NULL{code}

        Which fails. It should be:

        {code}ALTER TABLE `article` CHANGE `typeid` `listid` INT NOT NULL{code}
        Hide
        Matthew Hughes added a comment - - edited

        can confirm this behaviour on mysql w/ 1.2.4

        Show
        Matthew Hughes added a comment - - edited can confirm this behaviour on mysql w/ 1.2.4
        Hide
        Matthew Hughes added a comment -

        Attached is a patch that solves the issue.
        It's not the most elegan solution.
        But works and all tests pass.

        Show
        Matthew Hughes added a comment - Attached is a patch that solves the issue. It's not the most elegan solution. But works and all tests pass.
        Matthew Hughes made changes -
        Attachment DC-768.patch [ 10922 ]

        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=DC-768, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Jack Sleight
          • Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: