doctrine / data-fixtures

Doctrine2 ORM Data Fixtures Extensions
http://www.doctrine-project.org
MIT License
2.77k stars 224 forks source link

Table schema is not taken in account when purging since doctrine 2.5 #191

Closed plfort closed 9 years ago

plfort commented 9 years ago

Hello, Since I upgraded doctrine orm to 2.5, doctrine fixtures can't purge databse with table with specific schema (defined with @Table(name="hello",schema="mySchema") ) I think we should use the DefaultQuoteStrategy instead of getQuotedTableName in Purger

getQuotedTableName in ClassMetadaInfo is deprecated since 2.3 and does not take in account the "schema" attribute in metadata.

anthonyherve commented 9 years ago

Anther idea to resolve this problem : we can use method getSequencePrefix instead of getQuotedTableName

awildeep commented 9 years ago

Confirmed, I applied a hack to load my fixtures, but it is not a portable one so I won't bother to post it here. Perhaps there should be a getFullyQualifiedTableName() method? Something that could be driven by the platform.

jfitzgeraldgroup commented 9 years ago

We also have an issue with this as well. We are utilizing schemas in Postgresql and this is causing our Entities to break every time we run the Symfony console command to load fixtures.

The documentation shows that we should use...

@Table(name="tblName",schema="schName") 

but this does not work. We either have to put our schema name in the 'name' field like so

@Table(name="schName.tblName") 

which causes other issues in Symfony 2.7, or hack ORMPurger.php every time we do a composer update. Very frustrating!

awildeep commented 9 years ago

The correct format is:

@Table(name="tblName",schema="schName") 

Even for Doctrine 2.6. My guess is that the fixture loader was modified by a user that either does not use schemas, or doesn't have access to them to test properly.

BPScott commented 9 years ago

This is fixed by #192