-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1641 from AndyTWF/expand-srd-routes-table
fix: increase srd_routes column width
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
database/migrations/2024_09_20_101202_expand_srd_routes_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class extends Migration { | ||
/** | ||
* Run the migrations. | ||
*/ | ||
public function up(): void | ||
{ | ||
// Update the srd_note_srd_route table to drop the foreign key constraint on the srd_routes table | ||
Schema::table('srd_note_srd_route', function (Blueprint $table) { | ||
$table->dropForeign('srd_note_srd_route_srd_route_id_foreign'); | ||
}); | ||
|
||
// Update the srd_routes table to make the id column a bigIncrements rather than a smallIncrements | ||
Schema::table('srd_routes', function (Blueprint $table) { | ||
$table->bigIncrements('id')->first()->change(); | ||
}); | ||
|
||
// Now update the srd_note_srd_route table to make the srd_route_id column a bigInteger rather than an integer | ||
// and then re-add the foreign key constraint | ||
Schema::table('srd_note_srd_route', function (Blueprint $table) { | ||
$table->unsignedBigInteger('srd_route_id')->first()->change(); | ||
$table->foreign('srd_route_id')->references('id')->on('srd_routes')->onDelete('cascade'); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
*/ | ||
public function down(): void | ||
{ | ||
// | ||
} | ||
}; |