A free open source IT asset/license management system
Add migration to fix webhook settings
Marcus Moore13956254ce2f
diff --git a/database/migrations/2025_05_20_190317_repopulate_webhook_selected_setting.php b/database/migrations/2025_05_20_190317_repopulate_webhook_selected_setting.phpnew file mode 100644index 0000000000..e552bbe113--- /dev/null+++ b/database/migrations/2025_05_20_190317_repopulate_webhook_selected_setting.php@@ -0,0 +1,39 @@+<?php++use Illuminate\Database\Migrations\Migration;+use Illuminate\Support\Facades\DB;++return new class extends Migration {+ /**+ * Run the migrations.+ */+ public function up(): void+ {+ $settings = DB::table('settings')->first();++ /** If webhook settings were cleared via the integration settings page,+ * the webhook_selected was cleared as well when it should have reset to "slack".+ */+ if (+ empty($settings->webhook_selected) &&+ (empty($settings->webhook_botname) && empty($settings->webhook_channel) && empty($settings->webhook_endpoint))+ ) {+ DB::table('settings')->update(['webhook_selected' => 'slack']);+ }++ /** If webhook settings were cleared via the integration settings page,+ * then slack settings were re-added; then webhook_selected was not being set to "slack" as needed.+ */+ if (str_contains($settings->webhook_endpoint, 'slack.com')) {+ DB::table('settings')->update(['webhook_selected' => 'slack']);+ }+ }++ /**+ * Reverse the migrations.+ */+ public function down(): void+ {+ //+ }+};