-
-
Notifications
You must be signed in to change notification settings - Fork 853
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 #1974 from krayin/webform-issue
🔧 fix: fixed #1932 webform issue
- Loading branch information
Showing
112 changed files
with
664 additions
and
568 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
...ages/Webkul/Activity/src/Database/Migrations/2025_01_17_151632_alter_activities_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,50 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Support\Facades\DB; | ||
use Illuminate\Support\Facades\Schema; | ||
|
||
return new class extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::table('activities', function (Blueprint $table) { | ||
$table->dropForeign('activities_user_id_foreign'); | ||
|
||
$table->unsignedInteger('user_id')->nullable()->change(); | ||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::table('activities', function (Blueprint $table) { | ||
// Disable foreign key checks temporarily. | ||
DB::statement('SET FOREIGN_KEY_CHECKS=0'); | ||
|
||
// Drop the foreign key constraint using raw SQL. | ||
DB::statement('ALTER TABLE activities DROP FOREIGN KEY activities_user_id_foreign'); | ||
|
||
// Drop the index. | ||
DB::statement('ALTER TABLE activities DROP INDEX activities_user_id_foreign'); | ||
|
||
// Change the column to be non-nullable. | ||
$table->unsignedInteger('user_id')->nullable(false)->change(); | ||
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade'); | ||
|
||
// Re-enable foreign key checks. | ||
DB::statement('SET FOREIGN_KEY_CHECKS=1'); | ||
}); | ||
} | ||
}; |
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
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
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
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
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
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
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
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
Oops, something went wrong.