refactor: move buildpack cleanup logic to model lifecycle hooks

Move buildpack switching cleanup from Livewire component to Application model's boot lifecycle. This improves separation of concerns and ensures cleanup happens consistently regardless of how the buildpack change is triggered. Also clears Dockerfile-specific data when switching away from dockerfile buildpack.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Andras BacsaiandClaude committed 2025-11-18 14:51:38 +01:00
1 parent d5813fd286
commit 0540b2eae5
5 files changed
+379 -14

No files matched your search

@@ -0,0 +1,31 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
// Clear dockerfile fields for applications not using dockerfile buildpack
DB::table('applications')
->where('build_pack', '!=', 'dockerfile')
->update([
'dockerfile' => null,
'dockerfile_location' => null,
'dockerfile_target_build' => null,
'custom_healthcheck_found' => false,
]);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
// No rollback needed - we're cleaning up corrupt data
}
};