【laravel5.6】 Laravel 数据迁移给表和字段添加注释

1 引用DB

use Illuminate\Support\Facades\DB;

2 up方法

public function up()
    {
        Schema::create('code_table', function (Blueprint $table) {
            $table->integer('id')->unsigned()->primary()->comment('这是字段注释');
            
           
        });
        DB::statement("ALTER TABLE `code_table` comment '这是表注释'");
    }

 

posted @ 2018-11-30 18:18  依然范儿特西  阅读(3708)  评论(0编辑  收藏  举报