I want to change some table columns in Laravel from nullable to having a default value. I installed doctrine/dbal, and created a new migration with the following columns I want to change (previously nullable):
public function up()
{
Schema::table('movies', function (Blueprint $table) {
$table->string('movieDirector')->default('')->change();
$table->string('movieGenre')->default('')->change();
$table->string('movieCast')->default('')->change();
});
}
However this doesn't seem to have done anything. Is it possible to do? Thanks!
You need to create a new migration using command:
Then, in that created migration class, add this line, using the
changemethod like this :To make these changes and run the migration, use the command: