feat: complete database backup management API#8505
Closed
ripgtxgt wants to merge 1 commit intocoollabsio:nextfrom
Closed
feat: complete database backup management API#8505ripgtxgt wants to merge 1 commit intocoollabsio:nextfrom
ripgtxgt wants to merge 1 commit intocoollabsio:nextfrom
Conversation
Changes
-------
### PATCH /databases/:uuid — backup configuration support
Adds optional backup_* fields so callers can configure (or auto-create)
a database's backup schedule through the existing resource endpoint,
without needing to know the scheduled_backup_uuid:
backup_save_s3, backup_frequency, backup_s3_storage_uuid,
backup_enabled, backup_disable_local_backup,
backup_databases_to_backup, backup_dump_all,
backup_retention_{amount,days,max_storage}_{locally,s3}
If no backup config exists for the database, one is automatically
created with sane defaults. The backup_* prefix avoids any collision
with existing database fields.
### GET /databases — last_successful_backup timestamp
Each backup_config entry now includes a `last_successful_backup`
ISO-8601 timestamp (null when no successful run has occurred yet),
satisfying the issue requirement to surface backup health at a glance
without a second API call.
### POST /databases/:uuid/backups — expose disable_local_backup
Added `disable_local_backup` (boolean) to the create-backup endpoint so
callers can configure S3-only backups from the start.
### PATCH /databases/:uuid/backups/:uuid — fix frequency validation + disable_local_backup
- The frequency field was previously validated with a strict enum
(every_minute|hourly|daily|weekly|monthly|yearly), preventing custom
cron expressions. Validation is now delegated to the same
`validate_cron_expression()` helper used by the create endpoint.
- Added `disable_local_backup` to the allowed/validated fields.
All other backup endpoints (GET backups, DELETE backup, DELETE execution,
GET executions) were already implemented and are unchanged.
Closes coollabsio#5672
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Completes the database backup management API requested in #5672. The core backup endpoints already existed; this PR fills the gaps:
1.
PATCH /databases/:uuid— newbackup_*fields to configure backup inline (no need to knowscheduled_backup_uuidfirst). Auto-creates backup config if none exists.2.
GET /databases— eachbackup_confignow includeslast_successful_backupISO-8601 timestamp.3.
POST /databases/:uuid/backups— exposedisable_local_backupfield.4.
PATCH /databases/:uuid/backups/:uuid— fixfrequencyvalidation to accept custom cron expressions (not just enum aliases); exposedisable_local_backup.Issues
Category
AI Usage
Steps to Test
PATCH /api/v1/databases/{uuid}withbackup_frequency,backup_save_s3,backup_enabledfieldsGET /api/v1/databasesand verifylast_successful_backupfield present inbackup_configsPOST /api/v1/databases/{uuid}/backupswithdisable_local_backup: trueand verify it savesContributor Agreement
Important