SQLite does not support addCommentOnTable() and addCommentOnColumn() but supports comments in CREATE TABLE query
CREATE TABLE `table_name` -- table comment
(
id INTEGER, -- field comment
);
The follow command throws an Exception in SQLite
./yii migrate:create post --command=table --fields='name:string(50):comment("Student Name")'
Due to column comment is initialized separately
|
$this->db->createCommand()->createTable($table, $columns, $options)->execute(); |
|
|
|
/** @psalm-var array<string, string> $columns */ |
|
foreach ($columns as $column => $type) { |
|
if ($type instanceof ColumnInterface) { |
|
$comment = $type->getComment(); |
|
if ($comment !== null) { |
|
$this->db->createCommand()->addCommentOnColumn($table, $column, $comment)->execute(); |
|
} |
|
} |
|
} |
The same for the follow command
./yii migrate:create post --command=table --table-comment='Posts of blog'
|
<?= $this->render(__DIR__ . '/_createTable.php', [ |
|
'table' => $table, |
|
'columns' => $columns, |
|
'foreignKeys' => $foreignKeys, |
|
]) |
|
?> |
|
<?php if (!empty($tableComment)) { |
|
echo $this->render(__DIR__ . '/_addComments.php', [ |
|
'table' => $table, |
|
'tableComment' => $tableComment, |
|
]); |
|
} |
SQLite does not support
addCommentOnTable()andaddCommentOnColumn()but supports comments inCREATE TABLEqueryThe follow command throws an
Exceptionin SQLite./yii migrate:create post --command=table --fields='name:string(50):comment("Student Name")'Due to column comment is initialized separately
db-migration/src/MigrationBuilder.php
Lines 199 to 209 in 44f9ac4
The same for the follow command
./yii migrate:create post --command=table --table-comment='Posts of blog'db-migration/resources/views/createTableMigration.php
Lines 42 to 53 in 940d988