How can I rename column in laravel using migration?

前端 未结 6 639
名媛妹妹
名媛妹妹 2020-12-04 20:55

I have columns as mentioned bellow:

public function up()
{
    Schema::create(\'stnk\', function(Blueprint $table)
    {
        $table->increments(\'id\         


        
6条回答
  •  眼角桃花
    2020-12-04 21:27

    Renaming Columns (Laravel 5.x)

    To rename a column, you may use the renameColumn method on the Schema builder. *Before renaming a column, be sure to add the doctrine/dbal dependency to your composer.json file.*

    Or you can simply required the package using composer...

    composer require doctrine/dbal
    

    Source: https://laravel.com/docs/5.0/schema#renaming-columns

    Note: Use make:migration and not migrate:make for Laravel 5.x

提交回复
热议问题