How to add comment to table (not column) in Laravel 5 migration?

☆樱花仙子☆ 提交于 2019-12-05 02:49:50

Currently, Laravel does not allow (does not have functionality) to put comment on tables, so You have to use workaround in Your migration:

DB::statement("ALTER TABLE `<YOUR_TABLE>` comment '<COMMENT>'");

For now there are no any option exist to add table comment like column add but then after you want to add the comment to table than you must have to use "DB" to add the comment to table.

For Example,

If you want to add the comment to website table then through below Syntax you can add the comment to table.

DB::select("ALTER TABLE website COMMENT = 'This table contains the website information for the application'");

NOTE: Before use above line you must have migrated website/ your table then n than you can use this.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!