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

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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM