Modify migration to allow larger file size, remove image_path column if available

This commit is contained in:
Afiq Hamzah
2024-03-27 10:51:05 +08:00
committed by nurafrinaalimi16
parent c657eafc70
commit 1ebdadec80
@@ -3,6 +3,7 @@
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
class AddPhotoColumnToNomineeTable extends Migration
{
@@ -14,9 +15,16 @@ class AddPhotoColumnToNomineeTable extends Migration
public function up()
{
Schema::table('nominee', function (Blueprint $table) {
$table->binary('photo')->nullable();
$table->dropColumn('image');
});
if (Schema::hasColumn('nominee', 'image_path')) {
Schema::table('nominee', function (Blueprint $table) {
$table->dropColumn('image_path');
});
}
DB::statement("ALTER TABLE nominee ADD photo MEDIUMBLOB");
}
/**