Support the ongoing development of Laravel.io →
posted 8 years ago
Database
Last updated 2 years ago.
0
Solution

OK, I could get it solved with the help from this thread. Wondering how did I miss it before. Here is the trick for someone got the same issue.

Schema::table('users', function (Blueprint $table) {
    $table->string('username')->nullable()->unique();
});

nullable() makes sure that the newly added column is filled with NULL for existing rows.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

nterms nterms Joined 19 May 2016

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.