yii2 icon indicating copy to clipboard operation
yii2 copied to clipboard

Missing direct access to addCheck() in migration

Open bobonov opened this issue 1 year ago • 4 comments

With merge https://github.com/yiisoft/yii2/commit/e0dde88b87aa135273376aa7344cb3e597f77f67 the addCheck() has been added in order to support check on table create/alter

But it is not directly accessible from the migration instance like

$this->addCheck()

It is missing the mapping inside yii2/db/Migration.php

It is possible to access it via

    $this->db->createCommand()->addCheck();

But as it is not documented, it is difficult to find without code digging.

Additional info

Q A
Yii version 2.0.47
PHP version 7.4
Operating system debian

bobonov avatar Apr 27 '23 10:04 bobonov

Good catch. Do you have time for a pull request?

samdark avatar May 04 '23 12:05 samdark

I think I can start to work on in a couple of weeks.

bobonov avatar May 05 '23 11:05 bobonov

Starting to work on it, a bit of delay due to university exams session. Looking at Migration.php and where to insert the new code, any preferences? The logic position should be between alterColumn() and addPrimaryKey() or between dropForeignKey() and createIndex()

bobonov avatar Jul 04 '23 07:07 bobonov

Looking at Migration.php and where to insert the new code, any preferences?

No. Feel free to choose it.

samdark avatar Jul 05 '23 03:07 samdark