The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
TableEditor support managing tables outside of public schema
Joshen Lim035085bd98aa
diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/HeaderTitle.tsx b/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/HeaderTitle.tsxindex ee0548c6721..f78b3bf6199 100644--- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/HeaderTitle.tsx+++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/HeaderTitle.tsx@@ -2,13 +2,18 @@ import { PostgresTable } from '@supabase/postgres-meta'import { Typography } from '@supabase/ui'interface Props {+ schema: stringtable: PostgresTableisDuplicating: boolean}-const HeaderTitle: React.FC<Props> = ({ table, isDuplicating }) => {+const HeaderTitle: React.FC<Props> = ({ schema, table, isDuplicating }) => {if (!table) {- return <>Create a new table</>+ return (+ <>+ Create a new table under <code>{schema}</code>+ </>+ )}if (isDuplicating) {return (diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.tsx b/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.tsxindex d03c3478f9b..990796f0f8b 100644--- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.tsx+++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.tsx@@ -121,6 +121,7 @@ const TableEditor: FC<Props> = ({if (isEmpty(errors)) {const payload: CreateTablePayload | UpdateTablePayload = {name: tableFields.name,+ schema: selectedSchema,comment: tableFields.comment,...(!isNewRecord && { rls_enabled: tableFields.isRLSEnabled }),}@@ -140,7 +141,6 @@ const TableEditor: FC<Props> = ({isRealtimeEnabled: tableFields.isRealtimeEnabled,isDuplicateRows: isDuplicateRows,}-saveChanges(payload, columns, isNewRecord, configuration, resolve)} else {resolve()@@ -156,7 +156,7 @@ const TableEditor: FC<Props> = ({key="TableEditor"visible={visible}// @ts-ignore- header={<HeaderTitle table={table} isDuplicating={isDuplicating} />}+ header={<HeaderTitle schema={selectedSchema} table={table} isDuplicating={isDuplicating} />}className={`transition-all duration-100 ease-in ${isImportingSpreadsheet ? ' mr-32' : ''}`}onCancel={closePanel}onConfirm={() => (resolve: () => void) => onSaveChanges(resolve)}diff --git a/studio/components/layouts/TableEditorLayout/TableEditorMenu.tsx b/studio/components/layouts/TableEditorLayout/TableEditorMenu.tsxindex c9c3218672a..ef8b37d2458 100644--- a/studio/components/layouts/TableEditorLayout/TableEditorMenu.tsx+++ b/studio/components/layouts/TableEditorLayout/TableEditorMenu.tsx@@ -51,6 +51,8 @@ const TableEditorMenu: FC<Props> = ({const [schemaViews, setSchemaViews] = useState<SchemaView[]>([])const [isRefreshing, setIsRefreshing] = useState<boolean>(false)+ const isLocked = meta.excludedSchemas.includes(selectedSchema || '')+// We may need to shift this to the schema store and do something like meta.schema.loadViews()// I don't need we need a separate store for viewsuseEffect(() => {@@ -90,13 +92,13 @@ const TableEditorMenu: FC<Props> = ({: schemaViews.filter((view) => view.name.includes(searchText))return (- <div className="my-6 mx-4 flex flex-col flex-grow space-y-6">+ <div className="my-6 mx-4 flex flex-grow flex-col space-y-6">{/* Schema selection dropdown */}<div className="px-3">{meta.schemas.isLoading ? (- <div className="h-[30px] border border-gray-500 px-3 rounded flex items-center space-x-3">+ <div className="flex h-[30px] items-center space-x-3 rounded border border-gray-500 px-3"><IconLoader className="animate-spin" size={12} />- <span className="text-xs text-scale-900">Loading schemas...</span>+ <span className="text-scale-900 text-xs">Loading schemas...</span></div>) : (<Listbox@@ -114,14 +116,10 @@ const TableEditorMenu: FC<Props> = ({key={schema.id}value={schema.name}// @ts-ignore- label={- <>- <span className="text-scale-900">schema</span> <span>{schema.name}</span>- </>- }+ label={schema.name}+ addOnBefore={() => <span className="text-scale-900">schema</span>}>- <span className="text-sm text-scale-900">schema</span>{' '}- <span className="text-sm text-scale-1200">{schema.name}</span>+ <span className="text-scale-1200 text-sm">{schema.name}</span></Listbox.Option>))}</Listbox>@@ -129,7 +127,7 @@ const TableEditorMenu: FC<Props> = ({</div><div className="space-y-1">- {selectedSchema === 'public' && (+ {!isLocked && (<div className="px-3">{/* Add new table button */}<Button@@ -149,7 +147,7 @@ const TableEditorMenu: FC<Props> = ({</div>)}{/* Table search input */}- <div className="block mb-2 px-3">+ <div className="mb-2 block px-3"><InputclassName="border-none"icon={@@ -179,7 +177,7 @@ const TableEditorMenu: FC<Props> = ({// @ts-ignoretitle={<>- <div className="w-full flex items-center justify-between">+ <div className="flex w-full items-center justify-between"><span>All tables</span><button className="cursor-pointer" onClick={refreshTables}><IconRefreshCw className={isRefreshing ? 'animate-spin' : ''} size={14} />@@ -229,7 +227,7 @@ const TableEditorMenu: FC<Props> = ({</Dropdown.Item>,]}>- <div className="text-scale-900 transition-colors hover:text-scale-1200">+ <div className="text-scale-900 hover:text-scale-1200 transition-colors"><IconChevronDown size={14} strokeWidth={2} /></div></Dropdown>@@ -249,7 +247,7 @@ const TableEditorMenu: FC<Props> = ({// @ts-ignoretitle={<>- <div className="w-full flex items-center justify-between">+ <div className="flex w-full items-center justify-between"><span>All views</span></div></>