Alter table Laravel 5 with migration

first of all create new migration using below command

php artisan make:migration Alter_your_comment_yourTableName --table=yourTableName

change the file as per your requirements and after that run the below command in composer

php artisan migrate

Modifying Columns would require doctrine/dbal package.

  1. Install the Package

    composer require doctrine/dbal
    
  2. Create a migration

    php artisan make:migration add_values_to_vote_column_in_votes_table
    
  3. Update the migration file

    Schema::table('votes', function (Blueprint $table) {
        $table->enum('vote', [' 1', ' 2', ' 3', ' 4', ' 5'])->change();
    });
    
  4. Run the migration

    php artisan migrate
    

Documentation


To do this you should follow these steps:

  1. create a new migration file

    php artisan make:migration update_votes_table
    
  2. open the newly created migration file (app_folder\database\migrations{date_migrationfile_was_created}-update_votes_tables.php)

  3. change the columns you want to change

For more details see the documentation on database migrations

Note: If you add your migrations file to the question we could provide more detailed help


this how i do it:

 php artisan make:migration Alter_votes_to_tableName --table=tableName

open the file and change it then

php artisan migrate