如何在Laravel 5迁移中向表(而非列)添加注释? [英] How to add comment to table (not column) in Laravel 5 migration?

查看:209
本文介绍了如何在Laravel 5迁移中向表(而非列)添加注释?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在Laravel 5迁移中向表(ot列)添加注释?

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

我目前知道如何向列添加评论,例如:

I currently know how to add comment to column like:

$table->tinyInteger('status')->comment('0: requested; -1: rejected; 1:confirmed');

那桌子呢?

推荐答案

当前,Laravel不允许(没有功能)在表上添加注释,因此您必须在迁移中使用替代方法:

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>'");

这篇关于如何在Laravel 5迁移中向表(而非列)添加注释?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆