File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ use Illuminate \Database \Migrations \Migration ;
4+ use Illuminate \Support \Facades \DB ;
5+
6+ return new class extends Migration {
7+ /**
8+ * Run the migrations.
9+ */
10+ public function up (): void
11+ {
12+ $ settings = DB ::table ('settings ' )->first ();
13+
14+ /** If webhook settings were cleared via the integration settings page,
15+ * the webhook_selected was cleared as well when it should have reset to "slack".
16+ */
17+ if (
18+ empty ($ settings ->webhook_selected ) &&
19+ (empty ($ settings ->webhook_botname ) && empty ($ settings ->webhook_channel ) && empty ($ settings ->webhook_endpoint ))
20+ ) {
21+ DB ::table ('settings ' )->update (['webhook_selected ' => 'slack ' ]);
22+ }
23+
24+ /** If webhook settings were cleared via the integration settings page,
25+ * then slack settings were re-added; then webhook_selected was not being set to "slack" as needed.
26+ */
27+ if (str_contains ($ settings ->webhook_endpoint , 'slack.com ' )) {
28+ DB ::table ('settings ' )->update (['webhook_selected ' => 'slack ' ]);
29+ }
30+ }
31+
32+ /**
33+ * Reverse the migrations.
34+ */
35+ public function down (): void
36+ {
37+ //
38+ }
39+ };
You can’t perform that action at this time.
0 commit comments