Answer the question
In order to leave comments, you need to log in
YII2 link generation for MyIsam tables?
Does YII 2.* have support for generating models with relationships through the COMMENT field for MyIsam tables? I tried to write CONSTRAINT FOREIGN KEY (name_of_this_field) REFERENCES related_table_name (related_field_name) in the comment of the related field, but it didn’t work for me.
Answer the question
In order to leave comments, you need to log in
MYISAM does not support FOREIGN KEY. Use InnoDB for this. As for the COMMENT field, there is no such support.
Good evening.
MyISAM type tables show relatively good...
No support, use InnoDB.
And connections can be made in models.
public funciton getName()
{
return $this->hasOne(Model::className(), [по каким полям связываете])
}
for the implementation of links in Yii2, it does not matter which engine is installed MyISAM, InnoDB or something else. You need to understand that foreign keys (FOREIGN KEY) are a mechanism that primarily provides data integrity and retrieval speed at the database level, but does not affect the data retrieval itself. I strongly recommend reading the data links information in the official documentation
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question