This commit is contained in:
Andras Bacsai
2024-12-11 11:37:56 +01:00
parent fcc94e6306
commit c08423395c
3 changed files with 18 additions and 5 deletions

View File

@@ -92,6 +92,7 @@ return new class extends Migration
$table->text('resend_api_key')->nullable(); $table->text('resend_api_key')->nullable();
$table->boolean('smtp_notifications_test')->default(false);
$table->boolean('smtp_notifications_deployments')->default(false); $table->boolean('smtp_notifications_deployments')->default(false);
$table->boolean('smtp_notifications_database_backups')->default(true); $table->boolean('smtp_notifications_database_backups')->default(true);
$table->boolean('smtp_notifications_scheduled_tasks')->default(false); $table->boolean('smtp_notifications_scheduled_tasks')->default(false);

View File

@@ -2,6 +2,7 @@
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
return new class extends Migration return new class extends Migration
@@ -33,6 +34,17 @@ return new class extends Migration
$table->unique(['team_id']); $table->unique(['team_id']);
}); });
$teams = DB::table('teams')->get();
foreach ($teams as $team) {
try {
DB::table('slack_notification_settings')->insert([
'team_id' => $team->id,
]);
} catch (\Throwable $e) {
\Log::error('Error migrating slack notification settings from teams table: '.$e->getMessage());
}
}
} }
/** /**

View File

@@ -45,11 +45,11 @@ return new class extends Migration
public function down(): void public function down(): void
{ {
Schema::table('instance_settings', function (Blueprint $table) { Schema::table('instance_settings', function (Blueprint $table) {
$table->string('smtp_from_address')->change(); $table->string('smtp_from_address')->nullable()->change();
$table->string('smtp_from_name')->change(); $table->string('smtp_from_name')->nullable()->change();
$table->string('smtp_recipients')->change(); $table->string('smtp_recipients')->nullable()->change();
$table->string('smtp_host')->change(); $table->string('smtp_host')->nullable()->change();
$table->string('smtp_username')->change(); $table->string('smtp_username')->nullable()->change();
}); });
if (DB::table('instance_settings')->exists()) { if (DB::table('instance_settings')->exists()) {