php - 如何使用 Laravel Migrations 在 Mysql 列中添加注释

标签 php laravel eloquent laravel-5.3

这就是我想要做的

if (!Schema::hasColumn('account_settings', 'minimum_onsite_length')) {
        Schema::table('account_settings', function (Blueprint $table) {
            $table->unsignedInteger('minimum_onsite_length')
                ->default(180)
                ->nullable()
                ->comment('This is comments')
            ;
        });
    }

但是评论没有显示在迁移中,我在这里遗漏了什么吗?

我也看过这个问题,但它不起作用 here

最佳答案

你可以这样试试,

if (!Schema::hasColumn('account_settings', 'minimum_onsite_length')) {
    Schema::table('account_settings', function (Blueprint $table) {
        $table->unsignedInteger('minimum_onsite_length')
            ->default(180)
            ->nullable()
            ->comment('This is comment');
    });
}

引用链接 herehere .

关于php - 如何使用 Laravel Migrations 在 Mysql 列中添加注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49256069/

相关文章:

php - 将检查来自表单的有效输入的正则表达式

javascript - Dropzone.js 显示存储的图像

php - 如何在 Laravel 中查询的 WHERE 子句中使用正则表达式?

php - 使用多个 Laravel 范围进行关系过滤的意外结果

php - MySQL插入独有技术

php - Symfony - 如何从 View 中选择的 html 标签获取数据

php - Laravel Eloquent 模型如何从关系表中获取数据

php - Laravel 5.5 Eloquent 在多于 1 列的情况下变得不同

php - 收到cURL错误: Empty reply from server

php - 未知的数据库