Closed
Description
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;