laravel 修改数据库字段属性

1.引入doctrine/dbal 依赖
方法: 命令行里输入

composer require doctrine/dbal

2.创建一个新的migration文件

php artisan make:migration modify_age_column_in_tests_table --table=tests

3.编辑新建的modify_age文件

    public function up()
    {
        Schema::table('tests', function (Blueprint $table) {
            $table->integer('age')->comment('年龄')->change();
        });
    }
    

4.使用命令提交

php artisan migrate

由此就完成对数据表字段的修改

posted @ 2018-12-11 09:42  MrBear  阅读(5746)  评论(0编辑  收藏  举报