Skip to content

Loading…

DDC-1172: Schema tool does not drop sequences on table drop for PostgreSql platform #1775

Closed
doctrinebot opened this Issue · 5 comments

2 participants

@doctrinebot

Jira issue originally created by user gedrox:

When recreating database using

$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.
@doctrinebot

Comment created by @beberlei:

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.

@doctrinebot

Comment created by @beberlei:

Fixed.

@doctrinebot

Issue was closed with resolution "Fixed"

@doctrinebot

Comment created by pylebecq:

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

@beberlei beberlei was assigned by doctrinebot
@doctrinebot doctrinebot added this to the 2.1 milestone
@doctrinebot doctrinebot closed this
@doctrinebot doctrinebot added the Bug label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.