Skip to content

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

Chore/misc fixes 251124 (#30641)

Joshen Limb01f1adaec4a
diff --git a/apps/studio/components/interfaces/Database/Indexes/CreateIndexSidePanel.tsx b/apps/studio/components/interfaces/Database/Indexes/CreateIndexSidePanel.tsx
index 52d804eccb4..04ee9e29162 100644
--- a/apps/studio/components/interfaces/Database/Indexes/CreateIndexSidePanel.tsx
+++ b/apps/studio/components/interfaces/Database/Indexes/CreateIndexSidePanel.tsx
@@ -1,7 +1,7 @@
import { useQueryClient } from '@tanstack/react-query'
import { Check, ChevronsUpDown, Loader2 } from 'lucide-react'
import Link from 'next/link'
-import { useEffect, useMemo, useState } from 'react'
+import { Fragment, useEffect, useMemo, useState } from 'react'
import { toast } from 'sonner'
import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
@@ -347,8 +347,8 @@ CREATE INDEX ON "${selectedSchema}"."${selectedEntity}" USING ${selectedIndexTyp
</SelectTrigger_Shadcn_>
<SelectContent_Shadcn_>
{INDEX_TYPES.map((index, i) => (
- <>
- <SelectItem_Shadcn_ key={index.name} value={index.value}>
+ <Fragment key={index.name}>
+ <SelectItem_Shadcn_ value={index.value}>
<div className="flex flex-col gap-0.5">
<span>{index.name}</span>
{index.description.split('\n').map((x, idx) => (
@@ -362,7 +362,7 @@ CREATE INDEX ON "${selectedSchema}"."${selectedEntity}" USING ${selectedIndexTyp
</div>
</SelectItem_Shadcn_>
{i < INDEX_TYPES.length - 1 && <SelectSeparator_Shadcn_ />}
- </>
+ </Fragment>
))}
</SelectContent_Shadcn_>
</Select_Shadcn_>
diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.tsx b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.tsx
index bd5264360ea..d4a9cab8f33 100644
--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.tsx
+++ b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.tsx
@@ -264,6 +264,7 @@ const ColumnEditor = ({
<ColumnType
showRecommendation
value={columnFields?.format ?? ''}
+ layout="vertical"
enumTypes={enumTypes}
error={errors.format}
description={
@@ -322,7 +323,13 @@ const ColumnEditor = ({
column={columnFields}
relations={fkRelations}
closePanel={closePanel}
- onUpdateColumnType={(format: string) => onUpdateField({ format })}
+ onUpdateColumnType={(format: string) => {
+ if (format[0] === '_') {
+ onUpdateField({ format: format.slice(1), isArray: true, isIdentity: false })
+ } else {
+ onUpdateField({ format })
+ }
+ }}
onUpdateFkRelations={setFkRelations}
/>
</FormSectionContent>
diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnForeignKey.tsx b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnForeignKey.tsx
index 978708152af..f60a3cd2215 100644
--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnForeignKey.tsx
+++ b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnForeignKey.tsx
@@ -44,7 +44,12 @@ const ColumnForeignKey = ({
id,
})
const formattedColumnsForFkSelector = (table?.columns ?? []).map((c) => {
- return { id: c.id, name: c.name, format: column.format, isNewColumn: false }
+ return {
+ id: c.id,
+ name: c.name,
+ format: c.format || column.format,
+ isNewColumn: false,
+ }
})
const getRelationStatus = (fk: ForeignKey) => {
diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnType.tsx b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnType.tsx
index 43afef86ec2..9d8902cd8a7 100644
--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnType.tsx
+++ b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnType.tsx
@@ -49,6 +49,7 @@ interface ColumnTypeProps {
error?: any
disabled?: boolean
showLabel?: boolean
+ layout?: 'horizontal' | 'vertical'
description?: ReactNode
showRecommendation?: boolean
onOptionSelect: (value: string) => void
@@ -57,9 +58,9 @@ interface ColumnTypeProps {
const ColumnType = ({
value,
enumTypes = [],
- error,
disabled = false,
showLabel = true,
+ layout = 'horizontal',
description,
showRecommendation = false,
onOptionSelect = noop,
@@ -115,8 +116,8 @@ const ColumnType = ({
readOnly
disabled
label={showLabel ? 'Type' : ''}
- layout={showLabel ? 'horizontal' : undefined}
- className="md:gap-x-0"
+ layout={showLabel ? layout : undefined}
+ className="md:gap-x-0 [&>div>div]:text-left"
size="small"
icon={inferIcon(POSTGRES_DATA_TYPE_OPTIONS.find((x) => x.name === value)?.type ?? '')}
value={value}