Created
July 31, 2023 23:42
-
-
Save diegoglz-dev/9d1d29070daa130f02fa7fad65f0282b to your computer and use it in GitHub Desktop.
Change nullable foreign key on production.
This file contains hidden or 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
| <?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 | |
| { | |
| Schema::table('items', function (Blueprint $table) { | |
| $table->unsignedBigInteger('product_id')->nullable()->change(); | |
| }); | |
| } | |
| /** | |
| * Reverse the migrations. | |
| */ | |
| public function down(): void | |
| { | |
| Schema::table('items', function (Blueprint $table) { | |
| $table->unsignedBigInteger('product_id')->change(); | |
| }); | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment