fix: create pushover settings for existing teams
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
@@ -42,7 +43,7 @@ return new class extends Migration
|
||||
'team_id' => $team->id,
|
||||
]);
|
||||
} catch (\Throwable $e) {
|
||||
\Log::error('Error migrating slack notification settings from teams table: '.$e->getMessage());
|
||||
Log::error('Error creating slack notification settings for existing teams: '.$e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -2,6 +2,8 @@
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
@@ -34,6 +36,17 @@ return new class extends Migration
|
||||
|
||||
$table->unique(['team_id']);
|
||||
});
|
||||
$teams = DB::table('teams')->get();
|
||||
|
||||
foreach ($teams as $team) {
|
||||
try {
|
||||
DB::table('pushover_notification_settings')->insert([
|
||||
'team_id' => $team->id,
|
||||
]);
|
||||
} catch (\Throwable $e) {
|
||||
Log::error('Error creating pushover notification settings for existing teams: '.$e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user