M
M
MasterCopipaster2020-10-08 17:06:55
Doctrine ORM
MasterCopipaster, 2020-10-08 17:06:55

Why doesn't doctrine create a foreign key when migrating to SQLITE?

Listen to the people, I came across such a country of garbage, I want smart people to enlighten me.
I have an ORM Doctrine project and a sqlite database
. The entity looks like this

class Repay
{
    /**
     * @var \Ramsey\Uuid\UuidInterface
     * @ORM\Id
     * @ORM\Column(type="uuid", unique=true, options={"comment":"UUID repay"})
     * @ORM\GeneratedValue(strategy="CUSTOM")
     * @ORM\CustomIdGenerator(class=UuidGenerator::class)
     */
    private $id;

    /**
     * @ORM\ManyToOne(targetEntity=TradeDeal::class)
     * @ORM\JoinColumn(name="trade_deal_id", referencedColumnName="id", nullable=false)
     * @ORM\Column(options={"comment":"comment"})
     */
    private $trade_deal_id;


Table is created:
CREATE TABLE repay (id CHAR(36) NOT NULL --UUID repay(DC2Type:uuid)
        , trade_deal_id VARCHAR(255) NOT NULL
        , PRIMARY KEY(id));

I expect that trade_deal_id will refer to the trade_deal table on the id field.
I indicated this in the anatomy, but as you can see from the DDL, the foreign key was not created, why? what did I write wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
MasterCopipaster, 2020-10-08
@MasterCopipaster

In short, I figured it out myself, a joke: You delete this line and everything works as it should ... WTF ...
@ORM\Column(options={"comment":"comment"})

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question