yii2 通过迁移工具(migration) 生成带有注释(comment)的数据表?

yii2 Yii2 · ez · 于 2年前 发布 · 982 次阅读

手写migration文件

使用$this->addCommentOnTable('{{%my_table}}', 'My comment for table');

命令行形式

Since Yii 2.0.14:

php yii migrate/create create_my_table_table --comment='My comment for table'

php yii migrate/create create_my_table_table -C='My comment for table'

生成结果如下:

    public function safeUp(): bool
    {
        $this->createTable('{{%my_table}}', [
            'id' => $this->primaryKey(),
        ]);
        $this->addCommentOnTable('{{%my_table}}', 'My comment for table');
    }
共收到 0 条回复
没有找到数据。
添加回复 (需要登录)
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册