From 4321164980fc726be8c71d12f2408b747f67d511 Mon Sep 17 00:00:00 2001 From: Watheq Alshowaiter Date: Thu, 18 Jul 2024 18:04:34 +0300 Subject: [PATCH] chore: make migrations suitable for backward compatibility for laravel 6 --- .../migrations/2024_07_13_090447_create_fathers_table.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/database/migrations/2024_07_13_090447_create_fathers_table.php b/database/migrations/2024_07_13_090447_create_fathers_table.php index 64b6e3f..cd01f5d 100644 --- a/database/migrations/2024_07_13_090447_create_fathers_table.php +++ b/database/migrations/2024_07_13_090447_create_fathers_table.php @@ -3,13 +3,19 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; +use WatheqAlshowaiter\ModelRequiredFields\Constants; +use Illuminate\Support\Facades\App; class CreateFathersTable extends Migration { public function up(): void { Schema::create('fathers', function (Blueprint $table) { - $table->id(); // primary key -> ignored + if ((float) App::version() >= Constants::VERSION_AFTER_ID_METHOD_SUPPORT) { + $table->id(); // primary key -> ignored + } else { + $table->bigIncrements('id'); // primary key -> ignored + } $table->boolean('active')->default(false); // default => ignored $table->string('name'); // required $table->string('email'); // required