Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore: update scheduled backups

dragarcia915fdbfc23f3
diff --git a/studio/components/interfaces/Database/Backups/BackupItem.tsx b/studio/components/interfaces/Database/Backups/BackupItem.tsx
index be03cf13da2..4e447f635d3 100644
--- a/studio/components/interfaces/Database/Backups/BackupItem.tsx
+++ b/studio/components/interfaces/Database/Backups/BackupItem.tsx
@@ -5,7 +5,6 @@ import { useRouter } from 'next/router'
import { Badge, Button, IconDownload } from 'ui'
import { confirmAlert } from 'components/to-be-cleaned/ModalsDeprecated/ConfirmModal'
-import { useBackupDownloadMutation } from 'data/database/backup-download-mutation'
import { useBackupRestoreMutation } from 'data/database/backup-restore-mutation'
import { setProjectStatus } from 'data/projects/projects-query'
import { useCheckPermissions, useStore } from 'hooks'
@@ -42,19 +41,6 @@ const BackupItem = ({ projectRef, backup, index }: BackupItemProps) => {
},
})
- const { mutate: downloadBackup, isLoading: isDownloading } = useBackupDownloadMutation({
- onSuccess: (res) => {
- const { fileUrl } = res
-
- // Trigger browser download by create,trigger and remove tempLink
- const tempLink = document.createElement('a')
- tempLink.href = fileUrl
- document.body.appendChild(tempLink)
- tempLink.click()
- document.body.removeChild(tempLink)
- },
- })
-
const onRestoreClick = () => {
confirmAlert({
title: 'Confirm to restore',
@@ -69,24 +55,12 @@ const BackupItem = ({ projectRef, backup, index }: BackupItemProps) => {
if (backup.status === 'COMPLETED')
return (
<div className="flex space-x-4">
- {backup.data.canRestore && (
- <Button
- type="default"
- disabled={!canTriggerScheduledBackups || isRestoring || isDownloading}
- onClick={onRestoreClick}
- >
- Restore
- </Button>
- )}
-
<Button
type="default"
- disabled={!canTriggerScheduledBackups || isRestoring || isDownloading}
- onClick={() => downloadBackup({ ref: projectRef, backup })}
- loading={isDownloading}
- icon={<IconDownload />}
+ disabled={!canTriggerScheduledBackups || isRestoring}
+ onClick={onRestoreClick}
>
- Download
+ Restore
</Button>
</div>
)
diff --git a/studio/data/database/backup-restore-mutation.ts b/studio/data/database/backup-restore-mutation.ts
index 983f666be2c..9b4db4a4900 100644
--- a/studio/data/database/backup-restore-mutation.ts
+++ b/studio/data/database/backup-restore-mutation.ts
@@ -16,7 +16,7 @@ export type Backup = components['schemas']['Backup']
export async function restoreFromBackup({ ref, backup }: BackupRestoreVariables) {
const { data, error } = await post('/platform/database/{ref}/backups/restore', {
params: { path: { ref } },
- body: { ...backup, status: backup.status as unknown as string },
+ body: { id: backup.id, isPhysicalBackup: backup.isPhysicalBackup },
})
if (error) throw error
return data