Doctrine 1
  1. Doctrine 1
  2. DC-928

[Migrations] Drop not null is not working in Postgres

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Migrations
    • Labels:
      None
    • Environment:
      Postgresql 8.4, Symfony 1.4, Doctrine 1.2

      Description

      When removing the not null from a column the migration does not change anything in the database. This is due to the following check on line 162 of lib/vendor/symfony/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Export/Pgsql.php
      if ( ! empty($field['definition']['notnull']))

      So if notnull is not there or set to false or '0' or 0 the code does not enter into that if statement and therefore no changes are done to the not null value of the column.

        Activity

        Lea Haensenberger created issue -
        Hide
        Lukas Kahwe added a comment -

        @Lea: can you write up a patch for this? would also be nice if you could check if the same issue affects other drivers.

        Show
        Lukas Kahwe added a comment - @Lea: can you write up a patch for this? would also be nice if you could check if the same issue affects other drivers.
        Hide
        Lea Haensenberger added a comment - - edited

        Here is a patch (attachment). The generate-migrations-diff Task in Symfony sets 'notnull' to an empty string if it's false in the schema.yml, therefore the check for empty string.

        I had a quick look at the classes for other DBs, but that seems to be a postgres only issue.

        Show
        Lea Haensenberger added a comment - - edited Here is a patch (attachment). The generate-migrations-diff Task in Symfony sets 'notnull' to an empty string if it's false in the schema.yml, therefore the check for empty string. I had a quick look at the classes for other DBs, but that seems to be a postgres only issue.
        Lea Haensenberger made changes -
        Field Original Value New Value
        Attachment dropNotNullPatch.patch [ 10861 ]

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

          People

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

            Dates

            • Created:
              Updated: