doctrine / data-fixtures

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

Quote table names that also are reserved keywords #334

Closed stephen-lewis closed 4 years ago

stephen-lewis commented 4 years ago

Technically a duplicate of PR #292 but with tests included.

Essentially, purging the database in DELETE mode prior to fixture load fails if any fixture entities use tables names with reserved words (e.g. 'User' in Postgres, or in the test case 'Group' in sqlite). The change makes ORMPurger->getTableName() use the same method as AbstractPlatform::getTruncateTableSQL() uses to get the table name (quoted as necessary).

Test case uses sqlite reserved word 'Group' as an example and checks returned table name is quoted correctly.

Closes #292

greg0ire commented 4 years ago

The tests fail, but https://github.com/doctrine/data-fixtures/pull/333 fixes the build

greg0ire commented 4 years ago

333 is not merged up yet, hence why the build is not fixed. Are you sure you should target master though? Is there a BC-break in your PR?

EDIT it's a patch so I guess/hope not, let's retarget