S
S
semki0962017-01-20 10:50:58
symfony
semki096, 2017-01-20 10:50:58

How to set a foreign key in a migration file (DoctrineMigrationsBundle Symfony)?

Tried in different ways - it does not work. For example like this

$table->foreign('user_id')->references('id')->on('users');

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Skobkin, 2017-01-20
@semki096

The foreign key must be given by your mapping. If it is not in the migration after doctrine:migrations:diff - you are doing something wrong with the mapping.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question