Skip to content

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

Chore/read replicas fixes 040324 (#21731)

Joshen Limcea8e45166f4
diff --git a/apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityActions.tsx b/apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityActions.tsx
index af7191c8fb2..796d1ca9fe5 100644
--- a/apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityActions.tsx
+++ b/apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityActions.tsx
@@ -28,6 +28,7 @@ import FavoriteButton from './FavoriteButton'
import SavingIndicator from './SavingIndicator'
import toast from 'react-hot-toast'
import { FileCog, Keyboard, SlidersHorizontal } from 'lucide-react'
+import { useSqlEditorStateSnapshot } from 'state/sql-editor'
export type UtilityActionsProps = {
id: string
@@ -48,6 +49,7 @@ const UtilityActions = ({
}: UtilityActionsProps) => {
const os = detectOS()
const project = useSelectedProject()
+ const snap = useSqlEditorStateSnapshot()
const showReadReplicasUI = project?.is_read_replicas_enabled
const [intellisenseEnabled, setIntellisenseEnabled] = useLocalStorageQuery(
@@ -97,7 +99,12 @@ const UtilityActions = ({
<div className="flex items-center justify-between gap-x-2 mx-2">
<div className="flex items-center">
- {showReadReplicasUI && <DatabaseSelector variant="connected-on-right" />}
+ {showReadReplicasUI && (
+ <DatabaseSelector
+ variant="connected-on-right"
+ onSelectId={() => snap.resetResult(id)}
+ />
+ )}
<RoleImpersonationPopover
serviceRoleLabel="postgres"
variant={showReadReplicasUI ? 'connected-on-both' : 'connected-on-right'}
diff --git a/apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityTabResults.tsx b/apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityTabResults.tsx
index a7037c1418e..0aba251dc3e 100644
--- a/apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityTabResults.tsx
+++ b/apps/studio/components/interfaces/SQLEditor/UtilityPanel/UtilityTabResults.tsx
@@ -1,3 +1,5 @@
+import { useParams } from 'common'
+import toast from 'react-hot-toast'
import { format } from 'sql-formatter'
import { AiIconAnimation, Button } from 'ui'
@@ -6,8 +8,9 @@ import { useSqlDebugMutation } from 'data/ai/sql-debug-mutation'
import { useEntityDefinitionsQuery } from 'data/database/entity-definitions-query'
import { useOrgSubscriptionQuery } from 'data/subscriptions/org-subscription-query'
import { isError } from 'data/utils/error-check'
-import { useLocalStorageQuery, useSelectedOrganization, useSelectedProject, useStore } from 'hooks'
+import { useLocalStorageQuery, useSelectedOrganization, useSelectedProject } from 'hooks'
import { IS_PLATFORM, LOCAL_STORAGE_KEYS, OPT_IN_TAGS } from 'lib/constants'
+import { useDatabaseSelectorStateSnapshot } from 'state/database-selector'
import { useSqlEditorStateSnapshot } from 'state/sql-editor'
import { useSqlEditor } from '../SQLEditor'
import { sqlAiDisclaimerComment } from '../SQLEditor.constants'
@@ -20,16 +23,17 @@ export type UtilityTabResultsProps = {
}
const UtilityTabResults = ({ id, isExecuting }: UtilityTabResultsProps) => {
- const { ui } = useStore()
- const organization = useSelectedOrganization()
+ const { ref } = useParams()
const snap = useSqlEditorStateSnapshot()
- const { mutateAsync: debugSql, isLoading: isDebugSqlLoading } = useSqlDebugMutation()
- const { setDebugSolution, setAiInput, setSqlDiff, sqlDiff, setSelectedDiffType } = useSqlEditor()
- const selectedOrganization = useSelectedOrganization()
+ const state = useDatabaseSelectorStateSnapshot()
const selectedProject = useSelectedProject()
- const isOptedInToAI = selectedOrganization?.opt_in_tags?.includes(OPT_IN_TAGS.AI_SQL) ?? false
- const [hasEnabledAISchema] = useLocalStorageQuery(LOCAL_STORAGE_KEYS.SQL_EDITOR_AI_SCHEMA, true)
+ const organization = useSelectedOrganization()
+
+ const { sqlDiff, setDebugSolution, setAiInput, setSqlDiff, setSelectedDiffType } = useSqlEditor()
+ const { mutateAsync: debugSql, isLoading: isDebugSqlLoading } = useSqlDebugMutation()
+ const isOptedInToAI = organization?.opt_in_tags?.includes(OPT_IN_TAGS.AI_SQL) ?? false
+ const [hasEnabledAISchema] = useLocalStorageQuery(LOCAL_STORAGE_KEYS.SQL_EDITOR_AI_SCHEMA, true)
const includeSchemaMetadata = (isOptedInToAI || !IS_PLATFORM) && hasEnabledAISchema
const { data } = useEntityDefinitionsQuery(
@@ -67,6 +71,9 @@ const UtilityTabResults = ({ id, isExecuting }: UtilityTabResultsProps) => {
const formattedError = (result.error?.formattedError?.split('\n') ?? []).filter(
(x: string) => x.length > 0
)
+ const readReplicaError =
+ state.selectedDatabaseId !== ref &&
+ result.error.message.includes('in a read-only transaction')
return (
<div className="bg-table-header-light [[data-theme*=dark]_&]:bg-table-header-dark">
@@ -105,50 +112,67 @@ const UtilityTabResults = ({ id, isExecuting }: UtilityTabResultsProps) => {
</pre>
))
) : (
- <p className="font-mono text-sm">{result.error?.message}</p>
+ <>
+ <p className="font-mono text-sm">Error: {result.error?.message}</p>
+ {readReplicaError && (
+ <p className="text-sm text-foreground-light">
+ Note: Read replicas are for read only queries. Run write queries on the
+ primary database instead.
+ </p>
+ )}
+ </>
)}
</div>
)}
- {!hasHipaaAddon && (
- <Button
- icon={
- <div className="scale-75">
- <AiIconAnimation className="w-3 h-3" loading={isDebugSqlLoading} />
- </div>
- }
- disabled={!!sqlDiff || isDebugSqlLoading}
- onClick={async () => {
- try {
- const { solution, sql } = await debugSql({
- sql: snippet.snippet.content.sql.replace(sqlAiDisclaimerComment, '').trim(),
- errorMessage: result.error.message,
- entityDefinitions,
- })
-
- const formattedSql = format(sql, {
- language: 'postgresql',
- keywordCase: 'lower',
- })
- setAiInput('')
- setDebugSolution(solution)
- setSqlDiff({
- original: snippet.snippet.content.sql,
- modified: formattedSql,
- })
- setSelectedDiffType(DiffType.Modification)
- } catch (error: unknown) {
- if (isError(error)) {
- ui.setNotification({
- category: 'error',
- message: `Failed to debug: ${error.message}`,
+
+ <div className="flex items-center gap-x-2">
+ {readReplicaError && (
+ <Button
+ className="py-2"
+ type="default"
+ onClick={() => {
+ state.setSelectedDatabaseId(ref)
+ snap.resetResult(id)
+ }}
+ >
+ Switch to primary database
+ </Button>
+ )}
+ {!hasHipaaAddon && (
+ <Button
+ icon={<AiIconAnimation className="scale-75 w-3 h-3" loading={isDebugSqlLoading} />}
+ disabled={!!sqlDiff || isDebugSqlLoading}
+ onClick={async () => {
+ try {
+ const { solution, sql } = await debugSql({
+ sql: snippet.snippet.content.sql.replace(sqlAiDisclaimerComment, '').trim(),
+ errorMessage: result.error.message,
+ entityDefinitions,
})
+
+ const formattedSql =
+ sqlAiDisclaimerComment +
+ '\n\n' +
+ format(sql, {
+ language: 'postgresql',
+ keywordCase: 'lower',
+ })
+ setAiInput('')
+ setDebugSolution(solution)
+ setSqlDiff({
+ original: snippet.snippet.content.sql,
+ modified: formattedSql,
+ })
+ setSelectedDiffType(DiffType.Modification)
+ } catch (error: unknown) {
+ if (isError(error)) toast.error(`Failed to debug: ${error.message}`)
}
- }
- }}
- >
- Debug with Supabase AI
- </Button>
- )}
+ }}
+ >
+ Debug with Supabase AI
+ </Button>
+ )}
+ </div>
</div>
</div>
)
diff --git a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/DeployNewReplicaPanel.tsx b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/DeployNewReplicaPanel.tsx
index 34d5447fe2b..582000c01ea 100644
--- a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/DeployNewReplicaPanel.tsx
+++ b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/DeployNewReplicaPanel.tsx
@@ -1,4 +1,5 @@
import { useParams } from 'common'
+import Link from 'next/link'
import { useEffect, useState } from 'react'
import toast from 'react-hot-toast'
import {
@@ -10,16 +11,14 @@ import {
SidePanel,
} from 'ui'
+import { WarningIcon } from 'components/ui/Icons'
import { Region, useReadReplicaSetUpMutation } from 'data/read-replicas/replica-setup-mutation'
-import { useProjectAddonsQuery } from 'data/subscriptions/project-addons-query'
-import { AWS_REGIONS, AWS_REGIONS_DEFAULT, AWS_REGIONS_KEYS, BASE_PATH } from 'lib/constants'
-import { AVAILABLE_REPLICA_REGIONS, AWS_REGIONS_VALUES } from './InstanceConfiguration.constants'
import { useReadReplicasQuery } from 'data/read-replicas/replicas-query'
-import Link from 'next/link'
import { useOrgSubscriptionQuery } from 'data/subscriptions/org-subscription-query'
+import { useProjectAddonsQuery } from 'data/subscriptions/project-addons-query'
import { useSelectedOrganization, useSelectedProject } from 'hooks'
-import { WarningIcon } from 'components/ui/Icons'
-import { getSemanticVersion } from 'lib/helpers'
+import { AWS_REGIONS, AWS_REGIONS_DEFAULT, AWS_REGIONS_KEYS, BASE_PATH } from 'lib/constants'
+import { AVAILABLE_REPLICA_REGIONS, AWS_REGIONS_VALUES } from './InstanceConfiguration.constants'
// [Joshen] FYI this is purely for AWS only, need to update to support Fly eventually
@@ -81,7 +80,7 @@ const DeployNewReplicaPanel = ({
// Will be following the primary's instance size for the time being
const defaultCompute =
addons?.selected_addons.find((addon) => addon.type === 'compute_instance')?.variant
- .identifier ?? 'ci_small'
+ .identifier ?? 'ci_micro'
const [selectedRegion, setSelectedRegion] = useState<string>(defaultRegion)
const [selectedCompute, setSelectedCompute] = useState(defaultCompute)
@@ -161,6 +160,7 @@ const DeployNewReplicaPanel = ({
</AlertDescription_Shadcn_>
</Alert_Shadcn_>
)}
+
{reachedMaxReplicas && (
<Alert_Shadcn_>
<WarningIcon />
@@ -172,6 +172,7 @@ const DeployNewReplicaPanel = ({
</AlertDescription_Shadcn_>
</Alert_Shadcn_>
)}
+
{/* [Joshen] Not particular about this warning as all users on prod are on AWS */}
{project?.cloud_provider !== 'AWS' && (
<Alert_Shadcn_>
@@ -185,6 +186,7 @@ const DeployNewReplicaPanel = ({
</AlertDescription_Shadcn_>
</Alert_Shadcn_>
)}
+
{currentPgVersion < 15 && (
<Alert_Shadcn_>
<WarningIcon />
@@ -207,6 +209,7 @@ const DeployNewReplicaPanel = ({
</AlertDescription_Shadcn_>
</Alert_Shadcn_>
)}
+
<Listbox
size="small"
id="region"
@@ -234,26 +237,27 @@ const DeployNewReplicaPanel = ({
))}
</Listbox>
- <Listbox
- disabled
- size="small"
- id="compute"
- name="compute"
- value={selectedCompute}
- onChange={setSelectedCompute}
- label="Select the instance size for your read replica"
- descriptionText="Read replicas will be on the same instance size as your primary"
- >
- {computeAddons.map((option) => (
- <Listbox.Option key={option.identifier} label={option.name} value={option.identifier}>
- {option.name}
- </Listbox.Option>
- ))}
- </Listbox>
+ <div className="flex flex-col gap-y-2">
+ <p className="text-foreground-light text-sm">
+ Read replicas will be on the same compute size as your primary database. Deploying a
+ read replica incurs additional{' '}
+ <span className="text-foreground">{selectedComputeMeta?.name}</span> compute hours.
+ Pricing is still in early access and is subject to change.
+ </p>
- {/* <p className="text-xs text-foreground-light">
- Show some preview info on cost for deploying this replica here
- </p> */}
+ <p className="text-foreground-light text-sm">
+ Read more about{' '}
+ <Link
+ href="https://supabase.com/docs/guides/platform/org-based-billing#usage-based-billing-for-compute"
+ target="_blank"
+ rel="noreferrer"
+ className="underline"
+ >
+ Usage-based billing
+ </Link>{' '}
+ for compute.
+ </p>
+ </div>
</SidePanel.Content>
</SidePanel>
)
diff --git a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.constants.ts b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.constants.ts
index a2a9ad88ef1..fb352377a31 100644
--- a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.constants.ts
+++ b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.constants.ts
@@ -1,4 +1,5 @@
-import { AWS_REGIONS, AWS_REGIONS_KEYS } from 'lib/constants'
+import { components } from 'data/api'
+import { AWS_REGIONS, AWS_REGIONS_KEYS, PROJECT_STATUS } from 'lib/constants'
export interface Region {
key: AWS_REGIONS_KEYS
@@ -12,6 +13,14 @@ export const NODE_WIDTH = 660
export const NODE_ROW_HEIGHT = 50
export const NODE_SEP = 20
+export const REPLICA_STATUS: {
+ [key: string]: components['schemas']['DatabaseStatusResponse']['status']
+} = {
+ ...PROJECT_STATUS,
+ INIT_READ_REPLICA: 'INIT_READ_REPLICA',
+ INIT_READ_REPLICA_FAILED: 'INIT_READ_REPLICA_FAILED',
+}
+
// [Joshen] Coordinates from https://github.com/jsonmaur/aws-regions/issues/11
// In the format of [lon, lat]
export const AWS_REGIONS_COORDINATES: { [key: string]: [number, number] } = {
diff --git a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.tsx b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.tsx
index f68593424aa..cbe5fb1cf77 100644
--- a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.tsx
+++ b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceConfiguration.tsx
@@ -49,13 +49,17 @@ const InstanceConfigurationUI = () => {
const [selectedReplicaToDrop, setSelectedReplicaToDrop] = useState<Database>()
const [selectedReplicaToRestart, setSelectedReplicaToRestart] = useState<Database>()
- const { data: loadBalancers, isSuccess: isSuccessLoadBalancers } = useLoadBalancersQuery({
+ const {
+ data: loadBalancers,
+ refetch: refetchLoadBalancers,
+ isSuccess: isSuccessLoadBalancers,
+ } = useLoadBalancersQuery({
projectRef,
})
const {
data,
error,
- refetch,
+ refetch: refetchReplicas,
isLoading,
isError,
isSuccess: isSuccessReplicas,
@@ -79,7 +83,8 @@ const InstanceConfigurationUI = () => {
// If any replica's status has changed, refetch databases
if (numComingUp.current !== comingUpReplicas.length) {
numComingUp.current = comingUpReplicas.length
- await refetch()
+ await refetchReplicas()
+ setTimeout(() => refetchLoadBalancers(), 2000)
}
// If all replicas are active healthy, stop fetching statuses
diff --git a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceNode.tsx b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceNode.tsx
index e4287339065..2272b91597c 100644
--- a/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceNode.tsx
+++ b/apps/studio/components/interfaces/Settings/Infrastructure/InfrastructureConfiguration/InstanceNode.tsx
@@ -11,12 +11,16 @@ import {
DropdownMenuItem,
DropdownMenuSeparator,
DropdownMenuTrigger,
+ IconHelpCircle,
IconMoreVertical,
+ TooltipContent_Shadcn_,
+ TooltipTrigger_Shadcn_,
+ Tooltip_Shadcn_,
} from 'ui'
import { formatDatabaseID } from 'data/read-replicas/replicas.utils'
import { BASE_PATH, PROJECT_STATUS } from 'lib/constants'
-import { NODE_SEP, NODE_WIDTH, Region } from './InstanceConfiguration.constants'
+import { NODE_SEP, NODE_WIDTH, REPLICA_STATUS, Region } from './InstanceConfiguration.constants'
interface NodeData {
id: string
@@ -190,11 +194,25 @@ export const ReplicaNode = ({ data }: NodeProps<ReplicaNodeData>) => {
<p className="text-sm truncate">
Replica {id.length > 0 && `(ID: ${formatDatabaseID(id)})`}
</p>
- {status === PROJECT_STATUS.ACTIVE_HEALTHY ? (
+ {status === REPLICA_STATUS.ACTIVE_HEALTHY ? (
<Badge color="green">Healthy</Badge>
- ) : status === PROJECT_STATUS.COMING_UP ? (
+ ) : status === REPLICA_STATUS.INIT_READ_REPLICA ? (
+ <Badge color="slate">Initializing</Badge>
+ ) : status === REPLICA_STATUS.INIT_READ_REPLICA_FAILED ? (
+ <>
+ <Badge color="red">Init failed</Badge>
+ <Tooltip_Shadcn_>
+ <TooltipTrigger_Shadcn_>
+ <IconHelpCircle />
+ </TooltipTrigger_Shadcn_>
+ <TooltipContent_Shadcn_ side="bottom" className="w-60 text-center">
+ Replica failed to initialize. Please drop this replica, and spin up a new one.
+ </TooltipContent_Shadcn_>
+ </Tooltip_Shadcn_>
+ </>
+ ) : status === REPLICA_STATUS.COMING_UP ? (
<Badge color="slate">Coming up</Badge>
- ) : status === PROJECT_STATUS.RESTORING ? (
+ ) : status === REPLICA_STATUS.RESTORING ? (
<Badge color="slate">Restoring</Badge>
) : (
<Badge color="amber">Unhealthy</Badge>
diff --git a/apps/studio/components/interfaces/Settings/Integrations/GithubIntegration/GithubSection.tsx b/apps/studio/components/interfaces/Settings/Integrations/GithubIntegration/GithubSection.tsx
index 35be467a13b..ab2481cc56b 100644
--- a/apps/studio/components/interfaces/Settings/Integrations/GithubIntegration/GithubSection.tsx
+++ b/apps/studio/components/interfaces/Settings/Integrations/GithubIntegration/GithubSection.tsx
@@ -153,7 +153,7 @@ const GitHubSection = () => {
name: connection.repository.name,
supabaseConfig: {
supabaseDirectory: connection.workdir,
- supabaseChangesOnly: connection.supabase_changes_only,
+ supabaseChangesOnly: (connection as any).supabase_changes_only, //[Joshen] potentially API codegen issue
},
} as any,
}}
diff --git a/apps/studio/data/api.d.ts b/apps/studio/data/api.d.ts
index f7986afbd26..b540eb11552 100644
--- a/apps/studio/data/api.d.ts
+++ b/apps/studio/data/api.d.ts
@@ -856,6 +856,10 @@ export interface paths {
/** Reassigns object owner from temp to postgres */
patch: operations['DatabaseOwnerController_finaliseOwnerReassign']
}
+ '/system/database/{ref}/password': {
+ /** Updates the database password */
+ patch: operations['DatabasePasswordController_updatePassword']
+ }
'/system/github-secret-alert': {
/** Reset JWT if leaked keys found by GitHub secret scanning */
post: operations['GithubSecretAlertController_resetJwt']
@@ -890,6 +894,10 @@ export interface paths {
/** Refreshes secrets */
post: operations['SecretsRefreshController_refreshSecrets']
}
+ '/system/health': {
+ /** Get API health status */
+ get: operations['HealthController_getStatus']
+ }
'/system/projects/{ref}/health-reporting': {
/** Updates a project's health status. */
put: operations['HealthReportingController_updateStatus']
@@ -922,12 +930,20 @@ export interface paths {
/** Gets usage stats */
get: operations['OrgUsageSystemController_getOrgUsage']
}
+ '/system/organizations/{slug}/billing/partner/usage-and-costs': {
+ /** Gets the partner usage and costs */
+ get: operations['PartnerBillingSystemController_getPartnerUsageAndCosts']
+ }
'/system/organizations/{slug}/billing/subscription': {
/** Gets the current subscription */
get: operations['OrgSubscriptionSystemController_getSubscription']
/** Updates subscription */
put: operations['OrgSubscriptionSystemController_updateSubscription']
}
+ '/system/organizations/{slug}/restrictions': {
+ /** Updates restriction status of an org */
+ put: operations['OrgRestrictionsSystemController_updateRestriction']
+ }
'/system/integrations/vercel/webhooks': {
/** Processes Vercel event */
post: operations['VercelWebhooksController_processEvent']
@@ -3548,6 +3564,8 @@ export interface components {
| 'RESTORING'
| 'UNKNOWN'
| 'UPGRADING'
+ | 'INIT_READ_REPLICA'
+ | 'INIT_READ_REPLICA_FAILED'
/** @enum {string} */
cloud_provider: 'AWS' | 'FLY'
db_port: number
@@ -3573,6 +3591,8 @@ export interface components {
| 'RESTORING'
| 'UNKNOWN'
| 'UPGRADING'
+ | 'INIT_READ_REPLICA'
+ | 'INIT_READ_REPLICA_FAILED'
identifier: string
}
UpdatePasswordBody: {
@@ -4282,6 +4302,11 @@ export interface components {
DeleteVercelConnectionResponse: {
id: string
}
+ GitHubAuthorization: {
+ id: number
+ user_id: number
+ sender_id: number
+ }
CreateGitHubAuthorizationBody: {
code: string
}
@@ -4308,7 +4333,6 @@ export interface components {
repository: components['schemas']['ListGitHubConnectionsRepository']
user: components['schemas']['ListGitHubConnectionsUser'] | null
workdir: string
- supabase_changes_only: boolean
}
ListGitHubConnectionsResponse: {
connections: components['schemas']['ListGitHubConnectionsConnection'][]
@@ -4353,6 +4377,9 @@ export interface components {
name: string
value: string
}
+ HealthResponse: {
+ healthy: boolean
+ }
ReportStatusBody: {
/** @enum {string} */
status:
@@ -4365,6 +4392,8 @@ export interface components {
| 'RESTORING'
| 'UNKNOWN'
| 'UPGRADING'
+ | 'INIT_READ_REPLICA'
+ | 'INIT_READ_REPLICA_FAILED'
reportingToken: string
databaseIdentifier: string
}
@@ -4386,6 +4415,8 @@ export interface components {
UpdateAddonAdminBody: {
addon_variant: components['schemas']['AddonVariantId']
addon_type: components['schemas']['ProjectAddonType']
+ /** @enum {string} */
+ proration_behaviour?: 'prorate_and_invoice_end_of_cycle' | 'prorate_and_invoice_now'
price_id?: string
}
SystemCreateProjectBody: {
@@ -4459,6 +4490,35 @@ export interface components {
tier: 'tier_payg' | 'tier_pro' | 'tier_free' | 'tier_team' | 'tier_enterprise'
price_id?: string
}
+ RestrictionData: {
+ grace_period_end?: string
+ /** @enum {string} */
+ restrictions?: 'drop_requests_402'
+ violations?: (
+ | 'exceed_db_size_quota'
+ | 'exceed_egress_quota'
+ | 'exceed_edge_functions_count_quota'
+ | 'exceed_edge_functions_invocations_quota'
+ | 'exceed_monthly_active_users_quota'
+ | 'exceed_realtime_connection_count_quota'
+ | 'exceed_realtime_message_count_quota'
+ | 'exceed_storage_size_quota'
+ | 'overdue_payment'
+ )[]
+ }
+ UpdateRestrictionsBody: {
+ /** @enum {string} */
+ restriction_status: 'grace_period' | 'grace_period_over' | 'null' | 'restricted'
+ restriction_data?: components['schemas']['RestrictionData']
+ no_notification?: boolean
+ }
+ UpdateRestrictionsResponse: {
+ slug: string
+ /** @enum {string} */
+ restriction_status?: 'grace_period' | 'grace_period_over' | 'null' | 'restricted'
+ restriction_data?: components['schemas']['RestrictionData']
+ message?: string
+ }
GetMetricsBody: {
/** @enum {string} */
metric: 'user_queries'
@@ -5405,7 +5465,7 @@ export interface components {
*/
itemName: string
/** @enum {string} */
- type: 'usage' | 'plan' | 'addon' | 'proration'
+ type: 'usage' | 'plan' | 'addon' | 'proration' | 'compute_credits'
/**
* @description In case of a usage item, the free usage included in the customers plan
* @example 100
@@ -10591,6 +10651,10 @@ export interface operations {
/** Gets the Vercel project with the given ID */
VercelProjectsController_getVercelProject: {
parameters: {
+ query: {
+ id: string
+ teamId: string
+ }
header: {
vercel_authorization: string
}
@@ -10861,6 +10925,11 @@ export interface operations {
/** Get GitHub authorization */
GitHubAuthorizationsController_getGitHubAuthorization: {
responses: {
+ 200: {
+ content: {
+ 'application/json': components['schemas']['GitHubAuthorization']
+ }
+ }
/** @description Failed to get GitHub authorization */
500: {
content: never
@@ -10876,9 +10945,7 @@ export interface operations {
}
responses: {
201: {
- content: {
- 'application/json': Record<string, never>
- }
+ content: never
}
/** @description Failed to create GitHub authorization */
500: {
@@ -11214,6 +11281,32 @@ export interface operations {
}
}
}
+ /** Updates the database password */
+ DatabasePasswordController_updatePassword: {
+ parameters: {
+ path: {
+ /** @description Project ref */
+ ref: string
+ }
+ }
+ requestBody: {
+ content: {
+ 'application/json': components['schemas']['UpdatePasswordBody']
+ }
+ }
+ responses: {
+ 200: {
+ content: never
+ }
+ 403: {
+ content: never
+ }
+ /** @description Failed to update database password */
+ 500: {
+ content: never
+ }
+ }
+ }
/** Reset JWT if leaked keys found by GitHub secret scanning */
GithubSecretAlertController_resetJwt: {
parameters: {
@@ -11381,6 +11474,20 @@ export interface operations {
}
}
}
+ /** Get API health status */
+ HealthController_getStatus: {
+ responses: {
+ 200: {
+ content: {
+ 'application/json': components['schemas']['HealthResponse']
+ }
+ }
+ /** @description Failed to retrieve API health status */
+ 500: {
+ content: never
+ }
+ }
+ }
/** Updates a project's health status. */
HealthReportingController_updateStatus: {
parameters: {
@@ -11533,6 +11640,24 @@ export interface operations {
}
}
}
+ /** Gets the partner usage and costs */
+ PartnerBillingSystemController_getPartnerUsageAndCosts: {
+ parameters: {
+ path: {
+ /** @description Organization slug */
+ slug: string
+ }
+ }
+ responses: {
+ 200: {
+ content: never
+ }
+ /** @description Failed to retrieve subscription */
+ 500: {
+ content: never
+ }
+ }
+ }
/** Gets the current subscription */
OrgSubscriptionSystemController_getSubscription: {
parameters: {
@@ -11574,6 +11699,31 @@ export interface operations {
}
}
}
+ /** Updates restriction status of an org */
+ OrgRestrictionsSystemController_updateRestriction: {
+ parameters: {
+ path: {
+ /** @description Organization slug */
+ slug: string
+ }
+ }
+ requestBody: {
+ content: {
+ 'application/json': components['schemas']['UpdateRestrictionsBody']
+ }
+ }
+ responses: {
+ 200: {
+ content: {
+ 'application/json': components['schemas']['UpdateRestrictionsResponse']
+ }
+ }
+ /** @description Failed to update restriction status */
+ 500: {
+ content: never
+ }
+ }
+ }
/** Processes Vercel event */
VercelWebhooksController_processEvent: {
parameters: {
diff --git a/apps/studio/data/read-replicas/replica-remove-mutation.ts b/apps/studio/data/read-replicas/replica-remove-mutation.ts
index 6cbc22aab3e..2601e7b5a1d 100644
--- a/apps/studio/data/read-replicas/replica-remove-mutation.ts
+++ b/apps/studio/data/read-replicas/replica-remove-mutation.ts
@@ -42,7 +42,7 @@ export const useReadReplicaRemoveMutation = ({
async onSuccess(data, variables, context) {
const { projectRef, identifier, skipInvalidateOnSuccess } = variables
- if (!!skipInvalidateOnSuccess) {
+ if (skipInvalidateOnSuccess === false) {
// [Joshen] Just FYI, will remove this once API changes to remove the need for optimistic rendering
queryClient.setQueriesData<any>(replicaKeys.list(projectRef), (old: any) => {
return old.filter((db: Database) => db.identifier !== identifier)
diff --git a/apps/studio/state/sql-editor.ts b/apps/studio/state/sql-editor.ts
index 6764bdac3ac..4f234c0863b 100644
--- a/apps/studio/state/sql-editor.ts
+++ b/apps/studio/state/sql-editor.ts
@@ -140,6 +140,11 @@ export const sqlEditorState = proxy({
addNeedsSaving: (id: string) => {
sqlEditorState.needsSaving.add(id)
},
+ resetResult: (id: string) => {
+ if (sqlEditorState.results[id]) {
+ sqlEditorState.results[id] = []
+ }
+ },
addResult: (id: string, results: any[]) => {
if (sqlEditorState.results[id]) {
sqlEditorState.results[id].unshift({ rows: results })