doctrine / orm

Doctrine Object Relational Mapper (ORM)
https://www.doctrine-project.org/projects/orm.html
MIT License
9.86k stars 2.5k forks source link

fix: pass join column options to FK #11499

Open vencakrecl opened 1 week ago

vencakrecl commented 1 week ago

Summary

Pass options to FK because of \Doctrine\DBAL\Platforms\PostgreSQLPlatform::getAdvancedForeignKeyOptionsSQL

How to use

#[ORM\JoinColumn(name: 'customer_id', options: ['deferrable' => true, 'deferred' => true])]
derrabus commented 1 week ago

Thank you. Can you please add a functional test that actually creates such a foreign key?

vencakrecl commented 1 week ago

@derrabus done, see https://github.com/doctrine/orm/pull/11499/commits/f68b5e33f2540be4aa8795e365bb251be09fdcc0

derrabus commented 1 week ago

No, your test compares the generated SQL. But that SQL still does not hit a database.

vencakrecl commented 1 week ago

@derrabus If I understood, should I add the test \Doctrine\Tests\ORM\Functional\SchemaTool\PostgreSqlSchemaToolTest here?

derrabus commented 1 week ago

Sounds about right to me. 🙂