Skip to content

Commit

Permalink
fix: version before laravel 6 in sons migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
WatheqAlshowaiter committed Aug 22, 2024
1 parent dc2f9f5 commit ca4b0a7
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions database/migrations/2024_07_13_100247_create_sons_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,21 @@

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\App;
use Illuminate\Support\Facades\Schema;
use WatheqAlshowaiter\BackupTables\Constants;

class CreateSonsTable extends Migration
{
public function up(): void
{
Schema::create('sons', function (Blueprint $table) {
$table->bigIncrements('id'); // primary key => ignored
//$table->unsignedBigInteger('father_id');
//$table->foreignId('father_id'); // todo stop foreign keys temp

if((float) \Illuminate\Support\Facades\App::version() >= \WatheqAlshowaiter\BackupTables\Constants::VERSION_AFTER_FOREIGN_ID_SUPPORT){
if((float) App::version() >= Constants::VERSION_AFTER_FOREIGN_ID_SUPPORT){
$table->foreignId('father_id');
}else {
$table->unsignedBigInteger('father_id');
$table->foreign('father_id');
}
});
}
Expand Down

0 comments on commit ca4b0a7

Please sign in to comment.