diff --git a/apps/dokploy/components/dashboard/database/backups/add-backup.tsx b/apps/dokploy/components/dashboard/database/backups/add-backup.tsx index 5f349b24..219e4218 100644 --- a/apps/dokploy/components/dashboard/database/backups/add-backup.tsx +++ b/apps/dokploy/components/dashboard/database/backups/add-backup.tsx @@ -54,6 +54,7 @@ const AddPostgresBackup1Schema = z.object({ prefix: z.string().min(1, "Prefix required"), enabled: z.boolean(), database: z.string().min(1, "Database required"), + keepLatestCount: z.coerce.number().optional(), }); type AddPostgresBackup = z.infer; @@ -77,6 +78,7 @@ export const AddBackup = ({ databaseId, databaseType, refetch }: Props) => { enabled: true, prefix: "/", schedule: "", + keepLatestCount: undefined, }, resolver: zodResolver(AddPostgresBackup1Schema), }); @@ -88,6 +90,7 @@ export const AddBackup = ({ databaseId, databaseType, refetch }: Props) => { enabled: true, prefix: "/", schedule: "", + keepLatestCount: undefined, }); }, [form, form.reset, form.formState.isSubmitSuccessful]); @@ -117,6 +120,7 @@ export const AddBackup = ({ databaseId, databaseType, refetch }: Props) => { schedule: data.schedule, enabled: data.enabled, database: data.database, + keepLatestCount: data.keepLatestCount, databaseType, ...getDatabaseId, }) @@ -265,7 +269,7 @@ export const AddBackup = ({ databaseId, databaseType, refetch }: Props) => { - Use if you want to storage in a specific path of your + Use if you want to back up in a specific path of your destination/bucket @@ -274,6 +278,24 @@ export const AddBackup = ({ databaseId, databaseType, refetch }: Props) => { ); }} /> + { + return ( + + Keep the latest + + + + + Optional. If provided, only keeps the latest N backups in the cloud. + + + + ); + }} + /> ; } export const ShowBackups = ({ id, type }: Props) => { + const [activeManualBackup, setActiveManualBackup] = useState(); const queryMap = { postgres: () => api.postgres.one.useQuery({ postgresId: id }, { enabled: !!id }), @@ -106,7 +108,7 @@ export const ShowBackups = ({ id, type }: Props) => { {postgres?.backups.map((backup) => (
-
+
Destination @@ -137,6 +139,12 @@ export const ShowBackups = ({ id, type }: Props) => { {backup.enabled ? "Yes" : "No"}
+
+ Keep Latest + + {backup.keepLatestCount || 'All'} + +
@@ -145,8 +153,9 @@ export const ShowBackups = ({ id, type }: Props) => {