From c608e51fcef99ecb28999abbb49914e251100ff2 Mon Sep 17 00:00:00 2001 From: rosslh Date: Sat, 29 Aug 2026 09:57:49 -0400 Subject: [PATCH] feat(cleanup): default to threshold-mode docker cleanup every 10 minutes --- ...eploy_threshold_docker_cleanup_default.php | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 database/migrations/2026_08_29_000000_mapledeploy_threshold_docker_cleanup_default.php 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(); + }); + } +};