Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-1172

Schema tool does not drop sequences on table drop for PostgreSql platform

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.5
    • Fix Version/s: 2.1
    • Component/s: Tools
    • Security Level: All
    • Labels:
      None
    • Environment:
      PostgreSql 8.4

      Description

      When recreating database using

      $schemaTool->dropSchema($metaDatas);
      $schemaTool->createSchema($metaDatas);

      the second line fails with error that the sequence "tbl_id_seq" already exists. It's because the sequence is created without an owner column and schema tool doesn't include "drop sequence" statements in the drop SQL.

      I've created a patch which fixes the problem for my environment. Revision numbers in patch is from the local SVN. Doctrine base is 2.0.5.

        Activity

        Hide
        Benjamin Eberlei added a comment -

        That will always drop all sequences also when you only pass some classes in there. We need to find a better solution for this problem.

        Show
        Benjamin Eberlei added a comment - That will always drop all sequences also when you only pass some classes in there. We need to find a better solution for this problem.
        Hide
        Benjamin Eberlei added a comment -

        Fixed.

        Show
        Benjamin Eberlei added a comment - Fixed.
        Hide
        Pierre-Yves LEBECQ added a comment -

        I don't know if this is the right place to add a comment because this bug is quite old, and if anyone will see it but the code that fixed the reported bug seems to create a bug on my setup. The SchemaTool tries to drop two times the sequences, which produces an error.

        The following SQL is generated :

        ALTER TABLE utilisateurs DROP CONSTRAINT fk_497b315e7634f637;
        ALTER TABLE utilisateurs DROP CONSTRAINT fk_497b315e19863134;
        DROP SEQUENCE civilites_civ_id_seq;
        DROP SEQUENCE utilisateursClientType_ucty_id_seq;
        DROP SEQUENCE utilisateurs_user_id_seq;
        DROP SEQUENCE civilites_civ_id_seq;
        DROP SEQUENCE utilisateursclienttype_ucty_id_seq;
        DROP SEQUENCE utilisateurs_user_id_seq;
        DROP TABLE civilites;
        DROP TABLE utilisateursClientType;
        DROP TABLE utilisateurs

        I'm using postgres 9.1.8, Doctrine 2.3.2

        Show
        Pierre-Yves LEBECQ added a comment - I don't know if this is the right place to add a comment because this bug is quite old, and if anyone will see it but the code that fixed the reported bug seems to create a bug on my setup. The SchemaTool tries to drop two times the sequences, which produces an error. The following SQL is generated : ALTER TABLE utilisateurs DROP CONSTRAINT fk_497b315e7634f637; ALTER TABLE utilisateurs DROP CONSTRAINT fk_497b315e19863134; DROP SEQUENCE civilites_civ_id_seq; DROP SEQUENCE utilisateursClientType_ucty_id_seq; DROP SEQUENCE utilisateurs_user_id_seq; DROP SEQUENCE civilites_civ_id_seq; DROP SEQUENCE utilisateursclienttype_ucty_id_seq; DROP SEQUENCE utilisateurs_user_id_seq; DROP TABLE civilites; DROP TABLE utilisateursClientType; DROP TABLE utilisateurs I'm using postgres 9.1.8, Doctrine 2.3.2

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Aigars Gedroics
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: