Skip to content

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

chore: remove finalise migration action

Qiao Han745b0fa05a52
diff --git a/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/NotificationActions.tsx b/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/NotificationActions.tsx
index fa834094654..581129e15d8 100644
--- a/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/NotificationActions.tsx
+++ b/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/NotificationActions.tsx
@@ -13,7 +13,6 @@ interface NotificationActionsProps {
onSelectRestartProject: () => void
onSelectApplyMigration: () => void
onSelectRollbackMigration: () => void
- onSelectFinalizeMigration: () => void
}
const NotificationActions = ({
@@ -23,7 +22,6 @@ const NotificationActions = ({
onSelectRestartProject,
onSelectApplyMigration,
onSelectRollbackMigration,
- onSelectFinalizeMigration,
}: NotificationActionsProps) => {
const router = useRouter()
@@ -48,13 +46,7 @@ const NotificationActions = ({
</Button>
)
case ActionType.MigratePostgresSchema:
- if (action.reason === ActionReason.Finalize) {
- return (
- <Button type="default" onClick={onSelectFinalizeMigration}>
- Finalize
- </Button>
- )
- } else if (action.reason === ActionReason.Rollback) {
+ if (action.reason === ActionReason.Rollback) {
return (
<Button type="default" onClick={onSelectRollbackMigration}>
Rollback
diff --git a/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/NotificationRow.tsx b/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/NotificationRow.tsx
index d566e255a4f..35d2c42c055 100644
--- a/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/NotificationRow.tsx
+++ b/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/NotificationRow.tsx
@@ -16,7 +16,6 @@ export interface NotificationRowProps {
onSelectRestartProject: (project: Project, notification: Notification) => void
onSelectApplyMigration: (project: Project, notification: Notification) => void
onSelectRollbackMigration: (project: Project, notification: Notification) => void
- onSelectFinalizeMigration: (project: Project, notification: Notification) => void
}
const NotificationRow = ({
@@ -24,7 +23,6 @@ const NotificationRow = ({
onSelectRestartProject,
onSelectApplyMigration,
onSelectRollbackMigration,
- onSelectFinalizeMigration,
}: NotificationRowProps) => {
const { ui } = useStore()
const { data: projects } = useProjectsQuery()
@@ -95,7 +93,6 @@ const NotificationRow = ({
onSelectRestartProject={() => onSelectRestartProject(project, notification)}
onSelectApplyMigration={() => onSelectApplyMigration(project, notification)}
onSelectRollbackMigration={() => onSelectRollbackMigration(project, notification)}
- onSelectFinalizeMigration={() => onSelectFinalizeMigration(project, notification)}
/>
</div>
)}
diff --git a/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/index.tsx b/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/index.tsx
index 75493e64bfc..d8f536d297e 100644
--- a/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/index.tsx
+++ b/studio/components/layouts/ProjectLayout/LayoutHeader/NotificationsPopover/index.tsx
@@ -9,7 +9,7 @@ import { useQueryClient } from '@tanstack/react-query'
import dayjs from 'dayjs'
import { useRouter } from 'next/router'
import { Fragment, useState } from 'react'
-import { Alert, Button, IconArrowRight, IconBell, IconInbox, Popover } from 'ui'
+import { Button, IconArrowRight, IconBell, IconInbox, Popover } from 'ui'
import ConfirmModal from 'components/ui/Dialogs/ConfirmDialog'
import { useNotificationsQuery } from 'data/notifications/notifications-query'
@@ -17,7 +17,7 @@ import { useNotificationsUpdateMutation } from 'data/notifications/notifications
import { getProjectDetail } from 'data/projects/project-detail-query'
import { setProjectPostgrestStatus } from 'data/projects/projects-query'
import { useStore } from 'hooks'
-import { delete_, patch, post } from 'lib/common/fetch'
+import { delete_, post } from 'lib/common/fetch'
import { API_URL } from 'lib/constants'
import { Project } from 'types'
import NotificationRow from './NotificationRow'
@@ -38,7 +38,6 @@ const NotificationsPopover = ({ alt = false }: NotificationsPopoverProps) => {
const [projectToRestart, setProjectToRestart] = useState<Project>()
const [projectToApplyMigration, setProjectToApplyMigration] = useState<Project>()
const [projectToRollbackMigration, setProjectToRollbackMigration] = useState<Project>()
- const [projectToFinalizeMigration, setProjectToFinalizeMigration] = useState<Project>()
const [targetNotification, setTargetNotification] = useState<Notification>()
const newNotifications =
@@ -152,32 +151,6 @@ const NotificationsPopover = ({ alt = false }: NotificationsPopoverProps) => {
setProjectToRollbackMigration(undefined)
}
- const onConfirmProjectFinalizeMigration = async () => {
- if (!projectToFinalizeMigration) return
- const data = targetNotification?.data as PostgresqlUpgradeData
- const { resource } = data.additional as any
- if (!resource) return
- const res = await patch(`${API_URL}/database/${projectToFinalizeMigration.ref}/${resource}`, {})
- if (!res.error) {
- const project = await getProjectDetail({ ref: projectToFinalizeMigration.ref })
- if (project) {
- meta.setProjectDetails(project)
- }
-
- ui.setNotification({
- category: 'success',
- message: `Successfully finalized migration for project "${projectToFinalizeMigration.name}"`,
- })
- } else {
- ui.setNotification({
- error: res.error,
- category: 'error',
- message: `Failed to finalize migration: ${res.error.message}`,
- })
- }
- setProjectToFinalizeMigration(undefined)
- }
-
if (!notifications || !Array.isArray(notifications)) return null
return (
@@ -221,10 +194,6 @@ const NotificationsPopover = ({ alt = false }: NotificationsPopoverProps) => {
setProjectToRollbackMigration(project)
setTargetNotification(notification)
}}
- onSelectFinalizeMigration={(project, notification) => {
- setProjectToFinalizeMigration(project)
- setTargetNotification(notification)
- }}
/>
{i !== notifications.length - 1 && <Popover.Separator />}
</Fragment>
@@ -372,34 +341,6 @@ const NotificationsPopover = ({ alt = false }: NotificationsPopoverProps) => {
onSelectCancel={() => setProjectToRollbackMigration(undefined)}
onSelectConfirm={onConfirmProjectRollbackMigration}
/>
- <ConfirmModal
- danger
- size="small"
- visible={projectToFinalizeMigration !== undefined}
- title={`Finalize schema migration for "${projectToFinalizeMigration?.name}"`}
- // @ts-ignore
- description={
- <div className="text-scale-1200 space-y-4">
- <Alert withIcon variant="warning" title="This action canot be undone" />
- <div className="space-y-1">
- <p>The following schema migration will be finalized for the project</p>
- <ol className="list-disc pl-6">
- <li>
- <div className="flex items-center space-x-1">
- <p>{(targetNotification?.data as any)?.additional?.name}</p>
- <IconArrowRight size={12} strokeWidth={2} />
- <p>{(targetNotification?.data as any)?.additional?.version_to}</p>
- </div>
- </li>
- </ol>
- </div>
- </div>
- }
- buttonLabel="Confirm"
- buttonLoadingLabel="Confirm"
- onSelectCancel={() => setProjectToFinalizeMigration(undefined)}
- onSelectConfirm={onConfirmProjectFinalizeMigration}
- />
</>
)
}