DDC-417: @InheritanceType("SINGLE_TABLE") - The table with name 'inventory_basic' already exists. #519

Closed
opened 2026-01-22 12:41:10 +01:00 by admin · 9 comments
Owner

Originally created by @doctrinebot on GitHub (Mar 12, 2010).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user freeakk:

/****
 * @Entity
 * @InheritanceType("SINGLE_TABLE") 
 * @DiscriminatorColumn(name="discr", type="smallint")
 * @DiscriminatorMap({
 * "0" = "privateInventoryBasic",
 * "1" = "inventorySystem", 
 * "2" = "inventoryBattery",
 * "3" = "inventoryBus",
 * "4" = "inventoryCache",
 * "5" = "inventoryCdrom",
 * "6" = "inventoryCpu",
 * "7" = "inventoryDisk",
 * "8" = "inventoryDisplay",
 * "9" = "inventoryFirmware",
 * "10" = "inventoryMemory",
 * "11" = "inventoryMemoryBank",
 * "12" = "inventoryMemoryController",
 * "13" = "inventoryMultimedia",
 * "14" = "inventoryNetwork",
 * "15" = "inventoryPciHostBridge",
 * "16" = "inventoryStorage",
 * "17" = "inventorySystem",
 * "18" = "inventoryUsbBus",
 * "19" = "inventoryUsbGeneric",
 * "20" = "inventoryUsbHost",
 * "21" = "inventoryVolume"
 * })
 * @Table(name="inventory_basic")
 * @HasLifecycleCallbacks 
 */
class privateInventoryBasic
{ ....}
/****
 * @Entity
 */
class inventoryBattery extends privateInventoryBasic
{...}

etc...

Error when create tables from YAML schemas:

PHP Fatal error:  Uncaught exception 'Doctrine\DBAL\Schema\SchemaException' with message 'The table with name 'inventory_basic' already exists.' in /var/www/shelly/library/Doctrine/DBAL/Schema/SchemaException.php:70
Stack trace:
#0 /var/www/shelly/library/Doctrine/DBAL/Schema/Schema.php(91): Doctrine\DBAL\Schema\SchemaException::tableAlreadyExists('inventory_basic')
#1 /var/www/shelly/library/Doctrine/DBAL/Schema/Schema.php(187): Doctrine\DBAL\Schema\Schema->_addTable(Object(Doctrine\DBAL\Schema\Table))
#2 /var/www/shelly/library/Doctrine/ORM/Tools/SchemaTool.php(125): Doctrine\DBAL\Schema\Schema->createTable('inventory_basic')
#3 /var/www/shelly/library/Doctrine/ORM/Tools/SchemaTool.php(99): Doctrine\ORM\Tools\SchemaTool->getSchemaFromMetadata(Array)
#4 /var/www/shelly/library/Doctrine/ORM/Tools/SchemaTool.php(82): Doctrine\ORM\Tools\SchemaTool->getCreateSchemaSql(Array)
#5 /var/www/shelly/bin/gen*db*schema.php(10): Doctrine\ORM\Tools\SchemaTool->createSchema(Array)
#6 {main}
  thrown in /var/www/shelly/library/Doctrine/DBAL/Schema/SchemaException.php on line 70

Fatal error: Uncaught exception 'Doctrine\DBAL\Schema\SchemaException' with message 'The table with name 'inventory_basic' already exists.' in /var/www/shelly/library/Doctrine/DBAL/Schema/SchemaException.php:70
Stack trace:
#0 /var/www/shelly/library/Doctrine/DBAL/Schema/Schema.php(91): Doctrine\DBAL\Schema\SchemaException::tableAlreadyExists('inventory_basic')
#1 /var/www/shelly/library/Doctrine/DBAL/Schema/Schema.php(187): Doctrine\DBAL\Schema\Schema->_addTable(Object(Doctrine\DBAL\Schema\Table))
#2 /var/www/shelly/library/Doctrine/ORM/Tools/SchemaTool.php(125): Doctrine\DBAL\Schema\Schema->createTable('inventory_basic')
#3 /var/www/shelly/library/Doctrine/ORM/Tools/SchemaTool.php(99): Doctrine\ORM\Tools\SchemaTool->getSchemaFromMetadata(Array)
#4 /var/www/shelly/library/Doctrine/ORM/Tools/SchemaTool.php(82): Doctrine\ORM\Tools\SchemaTool->getCreateSchemaSql(Array)
#5 /var/www/shelly/bin/gen*db*schema.php(10): Doctrine\ORM\Tools\SchemaTool->createSchema(Array)
#6 {main}
  thrown in /var/www/shelly/library/Doctrine/DBAL/Schema/SchemaException.php on line 70
Originally created by @doctrinebot on GitHub (Mar 12, 2010). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user freeakk: ``` /**** * @Entity * @InheritanceType("SINGLE_TABLE") * @DiscriminatorColumn(name="discr", type="smallint") * @DiscriminatorMap({ * "0" = "privateInventoryBasic", * "1" = "inventorySystem", * "2" = "inventoryBattery", * "3" = "inventoryBus", * "4" = "inventoryCache", * "5" = "inventoryCdrom", * "6" = "inventoryCpu", * "7" = "inventoryDisk", * "8" = "inventoryDisplay", * "9" = "inventoryFirmware", * "10" = "inventoryMemory", * "11" = "inventoryMemoryBank", * "12" = "inventoryMemoryController", * "13" = "inventoryMultimedia", * "14" = "inventoryNetwork", * "15" = "inventoryPciHostBridge", * "16" = "inventoryStorage", * "17" = "inventorySystem", * "18" = "inventoryUsbBus", * "19" = "inventoryUsbGeneric", * "20" = "inventoryUsbHost", * "21" = "inventoryVolume" * }) * @Table(name="inventory_basic") * @HasLifecycleCallbacks */ class privateInventoryBasic { ....} ``` ``` /**** * @Entity */ class inventoryBattery extends privateInventoryBasic {...} ``` etc... Error when create tables from YAML schemas: ``` PHP Fatal error: Uncaught exception 'Doctrine\DBAL\Schema\SchemaException' with message 'The table with name 'inventory_basic' already exists.' in /var/www/shelly/library/Doctrine/DBAL/Schema/SchemaException.php:70 Stack trace: #0 /var/www/shelly/library/Doctrine/DBAL/Schema/Schema.php(91): Doctrine\DBAL\Schema\SchemaException::tableAlreadyExists('inventory_basic') #1 /var/www/shelly/library/Doctrine/DBAL/Schema/Schema.php(187): Doctrine\DBAL\Schema\Schema->_addTable(Object(Doctrine\DBAL\Schema\Table)) #2 /var/www/shelly/library/Doctrine/ORM/Tools/SchemaTool.php(125): Doctrine\DBAL\Schema\Schema->createTable('inventory_basic') #3 /var/www/shelly/library/Doctrine/ORM/Tools/SchemaTool.php(99): Doctrine\ORM\Tools\SchemaTool->getSchemaFromMetadata(Array) #4 /var/www/shelly/library/Doctrine/ORM/Tools/SchemaTool.php(82): Doctrine\ORM\Tools\SchemaTool->getCreateSchemaSql(Array) #5 /var/www/shelly/bin/gen*db*schema.php(10): Doctrine\ORM\Tools\SchemaTool->createSchema(Array) #6 {main} thrown in /var/www/shelly/library/Doctrine/DBAL/Schema/SchemaException.php on line 70 Fatal error: Uncaught exception 'Doctrine\DBAL\Schema\SchemaException' with message 'The table with name 'inventory_basic' already exists.' in /var/www/shelly/library/Doctrine/DBAL/Schema/SchemaException.php:70 Stack trace: #0 /var/www/shelly/library/Doctrine/DBAL/Schema/Schema.php(91): Doctrine\DBAL\Schema\SchemaException::tableAlreadyExists('inventory_basic') #1 /var/www/shelly/library/Doctrine/DBAL/Schema/Schema.php(187): Doctrine\DBAL\Schema\Schema->_addTable(Object(Doctrine\DBAL\Schema\Table)) #2 /var/www/shelly/library/Doctrine/ORM/Tools/SchemaTool.php(125): Doctrine\DBAL\Schema\Schema->createTable('inventory_basic') #3 /var/www/shelly/library/Doctrine/ORM/Tools/SchemaTool.php(99): Doctrine\ORM\Tools\SchemaTool->getSchemaFromMetadata(Array) #4 /var/www/shelly/library/Doctrine/ORM/Tools/SchemaTool.php(82): Doctrine\ORM\Tools\SchemaTool->getCreateSchemaSql(Array) #5 /var/www/shelly/bin/gen*db*schema.php(10): Doctrine\ORM\Tools\SchemaTool->createSchema(Array) #6 {main} thrown in /var/www/shelly/library/Doctrine/DBAL/Schema/SchemaException.php on line 70 ```
admin added the Bug label 2026-01-22 12:41:10 +01:00
admin closed this issue 2026-01-22 12:41:11 +01:00
Author
Owner

@doctrinebot commented on GitHub (Mar 12, 2010):

Comment created by @beberlei:

Have you called dropSchema() before?

@doctrinebot commented on GitHub (Mar 12, 2010): Comment created by @beberlei: Have you called dropSchema() before?
Author
Owner

@doctrinebot commented on GitHub (Mar 12, 2010):

Comment created by freeakk:

Yes. I have empty database

@doctrinebot commented on GitHub (Mar 12, 2010): Comment created by freeakk: Yes. I have empty database
Author
Owner

@doctrinebot commented on GitHub (Mar 14, 2010):

Comment created by @beberlei:

Attached a test-file to be deployed in tests/Doctrine/ORM/Functional/Ticket/

It simulates your mapping schema and runs perfectly without throwing the exception. Can you extend the test-case to fail due to your bug?

@doctrinebot commented on GitHub (Mar 14, 2010): Comment created by @beberlei: Attached a test-file to be deployed in tests/Doctrine/ORM/Functional/Ticket/ It simulates your mapping schema and runs perfectly without throwing the exception. Can you extend the test-case to fail due to your bug?
Author
Owner

@doctrinebot commented on GitHub (Mar 18, 2010):

Comment created by @beberlei:

Is this still relevant? I think it should be fixed with the removal of your duplicate "inventorySystem" instances.

@doctrinebot commented on GitHub (Mar 18, 2010): Comment created by @beberlei: Is this still relevant? I think it should be fixed with the removal of your duplicate "inventorySystem" instances.
Author
Owner

@doctrinebot commented on GitHub (Mar 19, 2010):

Issue was closed with resolution "Cannot Reproduce"

@doctrinebot commented on GitHub (Mar 19, 2010): Issue was closed with resolution "Cannot Reproduce"
Author
Owner

@doctrinebot commented on GitHub (Mar 19, 2010):

Comment created by freeakk:

Ok. Thank you

@doctrinebot commented on GitHub (Mar 19, 2010): Comment created by freeakk: Ok. Thank you
Author
Owner

@doctrinebot commented on GitHub (Mar 19, 2010):

Comment created by @beberlei:

@Uvarov: Maybe i didnt formulate it properly, does the issue still persist for you or not?

@doctrinebot commented on GitHub (Mar 19, 2010): Comment created by @beberlei: @Uvarov: Maybe i didnt formulate it properly, does the issue still persist for you or not?
Author
Owner

@doctrinebot commented on GitHub (Mar 19, 2010):

Comment created by freeakk:

This issue does not persist for me.

@doctrinebot commented on GitHub (Mar 19, 2010): Comment created by freeakk: This issue does not persist for me.
Author
Owner

@doctrinebot commented on GitHub (Dec 13, 2015):

Imported 1 attachments from Jira into https://gist.github.com/10f61cf94e4b32cc843e

@doctrinebot commented on GitHub (Dec 13, 2015): Imported 1 attachments from Jira into https://gist.github.com/10f61cf94e4b32cc843e - [10457_DDC417Test.php](https://gist.github.com/10f61cf94e4b32cc843e#file-10457_DDC417Test-php)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#519