SchemaTool generates extra diff for platforms without FK support #6319

Closed
opened 2026-01-22 15:30:52 +01:00 by admin · 1 comment
Owner

Originally created by @vpArth on GitHub (Sep 30, 2019).

Originally assigned to: @lcobucci on GitHub.

Bug Report

SchemaTool generates extra diff for platforms without FK support(ex: SqlitePlatform)

Q A
BC Break no
Version all

Summary

SchemaTool::getUpdateSchemaSql is never empty, because MetaData contains foreign keys adding, but SqlitePlatform has not support of them

How to reproduce

/** @ORM\Entity */
class A {
    /** @ORM\Id @ORM\Column(type="integer") @ORM\GeneratedValue */
    public $id;
    /** @ORM\OneToMany(targetEntity=B::class, mappedBy="parent") */
    public $children;
}
/** @ORM\Entity */
class B {
    /** @ORM\Id @ORM\Column(type="integer") @ORM\GeneratedValue */
    public $id;
    /** @ORM\ManyToOne(targetEntity=A::class) */
    public $parent;
}
// ...
    $class = $em->getClassMetadata(B::class);
    $schemaTool->updateSchema([$class]);
    $diff = $schemaTool->getUpdateSchemaSql([$class]);

Current behavior

count($diff) > 0;

Expected behavior

count($diff) === 0;
Originally created by @vpArth on GitHub (Sep 30, 2019). Originally assigned to: @lcobucci on GitHub. ### Bug Report SchemaTool generates extra diff for platforms without FK support(ex: SqlitePlatform) <!-- Fill in the relevant information below to help triage your issue. --> | Q | A |------------ | ------ | BC Break | no | Version | all #### Summary SchemaTool::getUpdateSchemaSql is never empty, because MetaData contains foreign keys adding, but SqlitePlatform has not support of them #### How to reproduce ```php /** @ORM\Entity */ class A { /** @ORM\Id @ORM\Column(type="integer") @ORM\GeneratedValue */ public $id; /** @ORM\OneToMany(targetEntity=B::class, mappedBy="parent") */ public $children; } /** @ORM\Entity */ class B { /** @ORM\Id @ORM\Column(type="integer") @ORM\GeneratedValue */ public $id; /** @ORM\ManyToOne(targetEntity=A::class) */ public $parent; } // ... $class = $em->getClassMetadata(B::class); $schemaTool->updateSchema([$class]); $diff = $schemaTool->getUpdateSchemaSql([$class]); ``` #### Current behavior ```php count($diff) > 0; ``` #### Expected behavior ```php count($diff) === 0; ```
admin added the Bug label 2026-01-22 15:30:52 +01:00
admin closed this issue 2026-01-22 15:30:52 +01:00
Author
Owner

@lcobucci commented on GitHub (Oct 2, 2019):

Handled by #7842

@lcobucci commented on GitHub (Oct 2, 2019): Handled by #7842
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#6319