Add table comments in Laravle 6’s database migration
1. In Laravle 6’s database migration, the data table option does not support adding comments. as shown in Figure 1
2. Reference:https://stackoverflow.com/questions/37493431/how-to-add-comment-to-table-not-column-in-laravel-5-migration. How to add comment to table (not column) in Laravel 5 migration?
3. The final realization is as follows
increments('id');
// ...
$table->timestamps();
});
DB::statement('ALTER TABLE ' . DB::connection()->getTablePrefix() . $tableName . ' COMMENT \'主题安装\'');
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('theme_installation');
}
}
4. After performing the database migration, check the execution results, and the table comments have been implemented. as shown in Figure 3


