Skip to content

Commit dc2f9f5

Browse files
fix: version before laravel 6 in sons migrations
1 parent 91b3f5b commit dc2f9f5

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

database/migrations/2024_07_13_100247_create_sons_table.php

+8-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,14 @@ public function up(): void
1111
Schema::create('sons', function (Blueprint $table) {
1212
$table->bigIncrements('id'); // primary key => ignored
1313
//$table->unsignedBigInteger('father_id');
14-
$table->foreignId('father_id'); // todo stop foreign keys temp
14+
//$table->foreignId('father_id'); // todo stop foreign keys temp
15+
16+
if((float) \Illuminate\Support\Facades\App::version() >= \WatheqAlshowaiter\BackupTables\Constants::VERSION_AFTER_FOREIGN_ID_SUPPORT){
17+
$table->foreignId('father_id');
18+
}else {
19+
$table->unsignedBigInteger('father_id');
20+
$table->foreign('father_id');
21+
}
1522
});
1623
}
1724

todos.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- [ ] add datbase droplist (sqilte, mysql, sql server, mariadb, postgres) + version for each of them in the ISSUE_TEMPLATE, and make it required and even add it to the next
1212
- [ ] use Stratigy pattern instead of switch with OOP features
1313
- [ ] clean up the code
14+
- [ ] return foreign key father_id
1415
- [ ] php storm recommendations
1516
- [ ] write automated tests for the code
1617
- [ ] write documentation for the code

0 commit comments

Comments
 (0)