I have a table called invoice_item. This table has a composite foreign key of "entity_id" and "table_name". It is a polymorphic relationship table. In MySQL, and most other relational databases, you can create a foreign key (or list of indexes) to reference a composite primary key like so…
FOREIGN KEY (`entity_id`,`table_name`) REFERENCES invoice_item(`entity_id`,`table_name`)
How can this be achieved using the standard Yii2 migration script "createTabel" method?