如何为表创建带注释的yii2迁移?
有没有什么当地的方法或是流传下来的?如何为表创建带注释的yii2迁移?,yii2,console-application,database-migration,Yii2,Console Application,Database Migration,有没有什么当地的方法或是流传下来的? 或者创建单独的迁移以向表中添加注释?有一种方法 $this->addCommentOnTable('table', 'Comment here...'); 将此方法添加到迁移文件中。有一种方法可用于此操作 $this->addCommentOnTable('table', 'Comment here...'); 将此方法添加到迁移文件中。自Yii 2.0.14以来: php yii migrate/create create_my_table
或者创建单独的迁移以向表中添加注释?有一种方法
$this->addCommentOnTable('table', 'Comment here...');
将此方法添加到迁移文件中。有一种方法可用于此操作
$this->addCommentOnTable('table', 'Comment here...');
将此方法添加到迁移文件中。自Yii 2.0.14以来:
php yii migrate/create create_my_table_table --comment='My comment for table'
或
结果
public function safeUp(): bool
{
$this->createTable('{{%my_table}}', [
'id' => $this->primaryKey(),
]);
$this->addCommentOnTable('{{%my_table}}', 'My comment for table');
}
自Yii 2.0.14以来:
php yii migrate/create create_my_table_table --comment='My comment for table'
或
结果
public function safeUp(): bool
{
$this->createTable('{{%my_table}}', [
'id' => $this->primaryKey(),
]);
$this->addCommentOnTable('{{%my_table}}', 'My comment for table');
}
我需要完全通过控制台命令向表中添加注释。我需要类似于:yii migrate/create create_test_table--fields=“…”--comment=“comment for my table”我需要完全通过控制台命令向表中添加注释。我需要类似于:yii migrate/create create_test_table--fields=“…”--comment=“comment for my table”我知道这个方法,这很容易。但我需要准确地从控制台向表中添加注释。据我所知,这不可能直接从控制台命令执行。我知道这个方法,很简单。但我需要准确地从控制台向表中添加注释。据我所知,这不可能直接从控制台命令执行。