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.php new file mode 100644 index 0000000000..e552bbe113 --- /dev/null +++ b/database/migrations/2025_05_20_190317_repopulate_webhook_selected_setting.php @@ -0,0 +1,39 @@ +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 + { + // + } +};