Код: Выделить всё
$this->createTable('{{%regions}}', [
'id' => $this->primaryKey(),
'name' => $this->string(),
], $tableOptions);
Но я посмотрел внутри метода сreateTable можно передать экземляр класса ColumnSchemaBuilder с полем comment
Код: Выделить всё
public function createTable($table, $columns, $options = null)
{
echo " > create table $table ...";
$time = microtime(true);
$this->db->createCommand()->createTable($table, $columns, $options)->execute();
foreach ($columns as $column => $type) {
if ($type instanceof ColumnSchemaBuilder && $type->comment !== null) {
$this->db->createCommand()->addCommentOnColumn($table, $column, $type->comment)->execute();
}
}
echo " done (time: " . sprintf('%.3f', microtime(true) - $time) . "s)\n";
}