diff --git a/database/migrations/2026_08_29_000000_mapledeploy_threshold_docker_cleanup_default.php b/database/migrations/2026_08_29_000000_mapledeploy_threshold_docker_cleanup_default.php new file mode 100644 index 000000000..3d9c661f7 --- /dev/null +++ b/database/migrations/2026_08_29_000000_mapledeploy_threshold_docker_cleanup_default.php @@ -0,0 +1,53 @@ + true, 'frequency' => '0 0 * * *', 'threshold' => 80]; + + private const MAPLEDEPLOY = ['force' => false, 'frequency' => '*/10 * * * *', 'threshold' => 75]; + + public function up(): void + { + Schema::table('server_settings', function (Blueprint $table) { + $table->boolean('force_docker_cleanup')->default(self::MAPLEDEPLOY['force'])->change(); + $table->string('docker_cleanup_frequency')->default(self::MAPLEDEPLOY['frequency'])->change(); + $table->integer('docker_cleanup_threshold')->default(self::MAPLEDEPLOY['threshold'])->change(); + }); + + // Only rows still on the untouched upstream default are moved, so a + // setting an operator chose deliberately is left alone. + DB::table('server_settings') + ->where('force_docker_cleanup', self::UPSTREAM['force']) + ->where('docker_cleanup_frequency', self::UPSTREAM['frequency']) + ->where('docker_cleanup_threshold', self::UPSTREAM['threshold']) + ->update([ + 'force_docker_cleanup' => self::MAPLEDEPLOY['force'], + 'docker_cleanup_frequency' => self::MAPLEDEPLOY['frequency'], + 'docker_cleanup_threshold' => self::MAPLEDEPLOY['threshold'], + ]); + } + + public function down(): void + { + Schema::table('server_settings', function (Blueprint $table) { + $table->boolean('force_docker_cleanup')->default(self::UPSTREAM['force'])->change(); + $table->string('docker_cleanup_frequency')->default(self::UPSTREAM['frequency'])->change(); + $table->integer('docker_cleanup_threshold')->default(self::UPSTREAM['threshold'])->change(); + }); + } +};