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

表 、字段注释

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'用户表'");//表注释

}

你可能感兴趣的:(laravel)