Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix bug purging table with a name as keyword sql. Added backquotes for table name. #22

Closed
wants to merge 1 commit into from

5 participants

@Sandex

No description provided.

@beberlei
Owner

This will break code with all databases which are case sensitive about table names (Oracle + PostgreSQL) so i cant merge it.

@Sandex

How to solve this problem properly?
Also need execute mysql query SET foreign_key_checks = 0 before purge.
Any suggestions.

@Nanakii

Hello, sorry to reup the topic but I got this issue today and I have a solution in mind.
Couldn't you add an argument in the console command such as "app/console doctrine:fixture:load --use-backquotes" ?
Let me know, thanks !

@deeky666
Collaborator

This has to be fixed in the platforms. We should wrap the table name inside AbstractPlatform::getTruncateTableSQL() with Doctrine\DBAL\Schema\Identifier which automatically quotes reserved keywords if necessary.

@lavoiesl lavoiesl added the Duplicate label
@lavoiesl
Collaborator

Superseeded by #149

@lavoiesl lavoiesl closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/Doctrine/Common/DataFixtures/Purger/ORMPurger.php
View
2  lib/Doctrine/Common/DataFixtures/Purger/ORMPurger.php
@@ -84,7 +84,7 @@ public function purge()
$platform = $this->em->getConnection()->getDatabasePlatform();
foreach($orderedTables as $tbl) {
- $this->em->getConnection()->executeUpdate($platform->getTruncateTableSQL($tbl, true));
+ $this->em->getConnection()->executeUpdate($platform->getTruncateTableSQL('`'.$tbl.'`', true));
}
}
Something went wrong with that request. Please try again.