Laravel 数据迁移给表和字段添加注释

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/yueruitao/article/details/82979132

表 、字段注释

use Illuminate\Support\Facades\DB;

public function up()

{

 Schema::create('user', function (Blueprint $table) {

  $table->increments('id')->index()->comment('用户id');

  $table->string('name')->default('')->comment('用户名');

  $table->string('email')->nullable()->comment('用户邮箱');

  $table->timestamps();

 });

DB::statement("ALTER TABLE 'user' comment'用户表'");//表注释

}

猜你喜欢

转载自blog.csdn.net/yueruitao/article/details/82979132