G
G
Greg Popov2016-05-11 10:44:37
MySQL
Greg Popov, 2016-05-11 10:44:37

How to create one:one key in migration in Yii2, but how to create one:many key?

Actually the whole question in the topic.
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Bay, 2016-05-11
@Gregpopov

$this->createIndex('index_name', 'user_pa', 'user_id');
$this->addForeignKey('idx_fk_name', 'user_pa', 'user_id', 'user', 'id', 'CASCADE', 'NO ACTION');
create an index, add a key.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question