0

I am using Laravel 5.5 and i would like to add an extra column to an existing table called users.

The problem is that php artisan migrate doesn't add the extra column.

1) Is it possible since table is not empty?

2) Why the below code block doesn't work?

By running php artisan make:migration update_users_column --table=users a file is created :

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class UpdateUsersColumn extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('users', function (Blueprint $table) {
            $table->boolean('email_sent_to_user', true);
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
//        Schema::table('users', function (Blueprint $table) {
//            //
//        });
    }
}

After running php artisan migrate the migrations table is updated but users table is not updated.

Antonios Tsimourtos
  • 1,676
  • 1
  • 14
  • 37

1 Answers1

1

The code block is working alright. The problem was with the procedure of transfering files from my local computer to the server(not correct permissions so the file was not actually uploaded after my edits).

Antonios Tsimourtos
  • 1,676
  • 1
  • 14
  • 37