Skip to content

Commit

Permalink
feat: return foreign key for sons table
Browse files Browse the repository at this point in the history
  • Loading branch information
WatheqAlshowaiter committed Aug 23, 2024
1 parent 3cc7a66 commit b7127d6
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions database/migrations/2024_07_13_100247_create_sons_table.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,14 @@ public function up(): void
Schema::create('sons', function (Blueprint $table) {
$table->bigIncrements('id');

if((float) App::version() >= Constants::VERSION_AFTER_FOREIGN_ID_SUPPORT){
$table->foreignId('father_id');
}else {
$table->unsignedBigInteger('father_id');
}
$table->unsignedBigInteger('father_id');
$table->foreign('father_id')->references('id')->on('fathers');
//
//if((float) App::version() >= Constants::VERSION_AFTER_FOREIGN_ID_SUPPORT){
// $table->foreignId('father_id');
//}else {
// $table->unsignedBigInteger('father_id');
//}
});
}

Expand Down

0 comments on commit b7127d6

Please sign in to comment.