Skip to content

Commit e8bafbf

Browse files
committed
Inheritance: mcve for different column name in inheritance
1 parent 7358a3f commit e8bafbf

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/TDBMAbstractServiceTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,17 @@ private static function initSchema(Connection $connection): void
466466
->column('fk_2')->integer()
467467
->then()->getDbalTable()->addForeignKeyConstraint($targetTable->getDbalTable(), ['fk_1', 'fk_2'], ['id_1', 'id_2']);
468468

469+
// Test case, the problem here is:
470+
// - `inheritance_agency` have an FK to `inheritance_society.**id_entity**`
471+
// - `inheritance_society` have an FK to `inheritance_entity.**id**`
472+
$db->table('inheritance_entity')
473+
->column('id')->integer()->primaryKey()->autoIncrement();
474+
$db->table('inheritance_society')
475+
->column('id_entity')->references('inheritance_entity')->primaryKey()
476+
->then();
477+
$db->table('inheritance_agency')
478+
->column('id')->integer()->primaryKey()->autoIncrement()
479+
->column('id_parent_society')->references('inheritance_society');
469480

470481
$sqlStmts = $toSchema->getMigrateFromSql($fromSchema, $connection->getDatabasePlatform());
471482

0 commit comments

Comments
 (0)