Resolves #7528 — Enables automated database backups for Docker Compose applications deployed via GitHub App (dockercompose buildpack).
Currently, database detection and backup scheduling only work for Empty Docker Compose and one-click services (Service model path). Git-based Docker Compose deployments (Application model path) detect databases via isDatabaseImage() but never create ServiceDatabase records, so backups are unavailable.
This PR adds full backup support by:
parseDockerComposeFile(), the Application model path now creates ServiceDatabase records for detected database containers (PostgreSQL, MySQL, MariaDB, MongoDB)application_id column (nullable) on service_databases, with service_id made nullable to support dual ownershipdockercompose build pack when databases are detected)CreateScheduledBackup and ScheduledBackups Livewire components — no new backup logic neededDatabaseBackupJob updated to resolve server, container name, and network from application-owned ServiceDatabase recordsdocker ps label filtering to find the actual running container (handles both consistent and non-consistent naming)isDeploymentInprogress() before executing for application-owned databasesparseDockerComposeFile() runs (on each deploy), stale ServiceDatabase records are automatically cleaned up if the database service was removed from the compose fileApplication::deleting() hook cleans up all compose database records and their scheduled backups when the application is deletedNew files (3):
database/migrations/2026_03_07_000001_add_application_id_to_service_databases.phpapp/Livewire/Project/Application/ComposeDatabaseBackups.phpresources/views/livewire/project/application/compose-database-backups.blade.phpModified files (7):
app/Models/ServiceDatabase.php — Dual ownership (Service or Application), getServer(), containerName(), updated team queriesapp/Models/Application.php — composeDatabases() relationship, cleanup on deletionapp/Models/ScheduledDatabaseBackup.php — Updated server() resolutionapp/Jobs/DatabaseBackupJob.php — Application-owned database support, deployment safety checkbootstrap/helpers/shared.php — ServiceDatabase creation in Application path, stale record cleanup, team resolutionresources/views/livewire/project/application/configuration.blade.php — Database Backups menu itemroutes/web.php — project.application.database-backups routeservice_id remains the primary FK for existing Service-owned databases (unchanged behavior)application_id is nullable, defaulting to null for all existing records/claim #7528
maoshuorz
@maoshuorz
Ilias Ism
@me