my code below is working fine. Problem is when i got data in database which is null in user_id field. Migration rollback will not pass successfully. What is good approach to solve this problem? Should i change every null in column user_id to empty string before i change nullable to false in rollback?
public function up()
{
Schema::table('classes', function (Blueprint $table) {
$table->text('user_id')->nullable()->change();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('classes', function (Blueprint $table) {
$table->text('user_id')->nullable(false)->change();
});
}