Laravel migrations change default value of column

You can use change() method:

Schema::table('users', function ($table) {
    $table->integer('active')->default(0)->change();
});

Then run migrate command.

Update

For Laravel 4 use something like this:

DB::statement('ALTER TABLE `users` CHANGE COLUMN `active` `active` INTEGER NOT NULL DEFAULT 0;');

Inside up() method instead of Schema::table(); clause.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)