mirror of
https://github.com/databasus/databasus.git
synced 2026-04-06 00:32:03 +02:00
FEATURE: Cluster-based PostgreSQL backup management & bulk import (1.x line) #364
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @omerkarabacak on 12/10/2025
PR description
Context / Versioning
main.v1.3.0up tov1.33.0, plus this cluster feature.mainbranch is currently atv2.0.3.v1.33.0, not againstv2.0.3. If you want this feature onmain, it would need to be ported to thev2.xcodebase.What this PR adds (high level)
Cluster-based backup management
clustersthat lets you:Workspace-aware, cluster-level scheduler
Databaserecords within the workspace (excluding templates/system DBs).Bulk import from cluster (frontend)
list-databases-directendpoint).Safer propagation of cluster defaults
Backend changes
New
clustersfeature (backend)Files under
backend/internal/features/clusters/…:Models
Workspace, holds default backup settings and notifiers.Service
PostgresqlDatabaselogic.Databaseif missing.Controller & routes
POST /clusters– create cluster.GET /clusters– list clusters byworkspace_id.PUT /clusters/{id}– update cluster.POST /clusters/{id}/run-backup– run cluster backup once.GET /clusters/{id}/databases– list accessible DBs in a cluster.GET /clusters/{id}/propagation/preview– preview changes to existing DBs.POST /clusters/{id}/propagation/apply– apply those changes.Background scheduler
BackupInterval.ShouldTriggerBackupandCluster.LastRunAtto decide when to run.LastRunAt.Backup configuration enhancements
ClusterID *uuid.UUIDManagedByCluster boolWHERE is_backups_enabled = TRUE AND (managed_by_cluster = FALSE OR cluster_id IS NULL)ManagedByCluster = true,ClusterID = cluster.ID.Migrations introduced by this PR (cluster-related)
New SQL migrations under
backend/migrations:clustersandpostgresql_clusterstables.cluster_excluded_databasestable.last_run_attracking to clusters.cluster_idandmanaged_by_clustercolumns tobackup_configs.These are additive and don’t change semantics for existing deployments that don’t use clusters.
Frontend changes
New “Clusters” tab
workspaceand permission info to ClustersComponent.Bulk DB creation from cluster
databaseApi.listDatabasesDirect.EditBackupConfigComponent(no extra API calls yet).EditDatabaseNotifiersComponent.Cluster API and models
frontend/src/entity/clusters:Docs
Changes vs
v1.3.0(high level)Compared to the older
v1.3.0tag, this branch already includes upstream 1.x features such as:Workspaces & access control
Extended storage and notifier support
User management & OAuth
This PR builds on top of those 1.x additions and adds cluster-based backup management on top.
Migration & compatibility notes
Existing installations without clusters
When using clusters
clusters,postgresql_clusters,cluster_excluded_databases, and cluster-relatedbackup_configscolumns are required.ManagedByCluster = trueandClusterIDset; they are then driven by the cluster scheduler.Testing
Things I’d recommend verifying/that this PR is designed to support:
Backend
v1.3.0line).Database+ BackupConfig.LastRunAtas expected.Frontend