Skip to content

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

Merge branch 'master' into chore/remove-pg-meta-schema-store

Alaister Younga9b5880d780e
diff --cc studio/components/interfaces/Database/Functions/CreateFunction.tsx
index 1786d2e0bac,1786d2e0bac..6b321df2402
--- a/studio/components/interfaces/Database/Functions/CreateFunction.tsx
+++ b/studio/components/interfaces/Database/Functions/CreateFunction.tsx
@@@ -7,9 -7,9 +7,11 @@@ import { Button, IconPlus, IconTrash, I
import { Dictionary } from 'components/grid'
import { Function } from 'components/interfaces/Functions/Functions.types'
import { POSTGRES_DATA_TYPES } from 'components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.constants'
++import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
import ConfirmationModal from 'components/ui/ConfirmationModal'
import Panel from 'components/ui/Panel'
import SqlEditor from 'components/ui/SqlEditor'
++import { useSchemasQuery } from 'data/database/schemas-query'
import { useStore } from 'hooks'
import { isResponseOk } from 'lib/common/fetch'
import { SupaResponse } from 'types'
@@@ -294,21 -294,21 +296,24 @@@ interface CreateFunctionProps
}
const CreateFunction = ({ func, visible, setVisible }: CreateFunctionProps) => {
++ const { project } = useProjectContext()
const { ui, meta } = useStore()
const _localState = useLocalObservable(() => new CreateFunctionStore())
_localState.meta = meta as any
const [isClosingPanel, setIsClosingPanel] = useState<boolean>(false)
-- useEffect(() => {
-- const fetchSchemas = async () => {
-- await (_localState!.meta as any).schemas.load()
-- const schemas = (_localState!.meta as any).schemas.list()
-- _localState.setSchemas(schemas)
++ useSchemasQuery(
++ {
++ projectRef: project?.ref,
++ connectionString: project?.connectionString,
++ },
++ {
++ onSuccess(schemas) {
++ _localState.setSchemas(schemas)
++ },
}
--
-- fetchSchemas()
-- }, [])
++ )
useEffect(() => {
_localState.formState.reset(func)
diff --cc studio/components/interfaces/Database/Functions/FunctionsList/FunctionsList.tsx
index e5a3c72c620,744ae63c80d..a50847e20b5
--- a/studio/components/interfaces/Database/Functions/FunctionsList/FunctionsList.tsx
+++ b/studio/components/interfaces/Database/Functions/FunctionsList/FunctionsList.tsx
@@@ -1,15 -1,17 +1,20 @@@
import * as Tooltip from '@radix-ui/react-tooltip'
-import { PostgresFunction, PostgresSchema } from '@supabase/postgres-meta'
+import { PostgresFunction } from '@supabase/postgres-meta'
import { PermissionAction } from '@supabase/shared-types/out/constants'
- import { includes, map as lodashMap, noop, uniqBy } from 'lodash'
+ import { noop, partition } from 'lodash'
import { observer } from 'mobx-react-lite'
import { useState } from 'react'
- import { Button, IconLoader, IconSearch, Input } from 'ui'
+ import { Button, IconLock, IconSearch, Input, Listbox } from 'ui'
++import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
import ProductEmptyState from 'components/to-be-cleaned/ProductEmptyState'
+ import Table from 'components/to-be-cleaned/Table'
++import AlertError from 'components/ui/AlertError'
+ import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'
++import { useSchemasQuery } from 'data/database/schemas-query'
import { useCheckPermissions, useStore } from 'hooks'
+import { EXCLUDED_SCHEMAS } from 'lib/constants/schemas'
- import SchemaTable from './SchemaTable'
+ import FunctionList from './FunctionList'
-import AlertError from 'components/ui/AlertError'
interface FunctionsListProps {
createFunction: () => void
@@@ -22,28 -24,26 +27,30 @@@ const FunctionsList = (
editFunction = noop,
deleteFunction = noop,
}: FunctionsListProps) => {
++ const { project } = useProjectContext()
const { meta } = useStore()
+ const [selectedSchema, setSelectedSchema] = useState<string>('public')
const [filterString, setFilterString] = useState<string>('')
- const functions = meta.functions.list(
- (fn: PostgresFunction) => !EXCLUDED_SCHEMAS.includes(fn.schema)
- )
- const filteredFunctions = functions.filter((x: PostgresFunction) =>
- includes(x.name?.toLowerCase(), filterString.toLowerCase())
- )
- const filteredFunctionSchemas = lodashMap(uniqBy(filteredFunctions, 'schema'), 'schema')
const canCreateFunctions = useCheckPermissions(
PermissionAction.TENANT_SQL_ADMIN_WRITE,
'functions'
)
- const schemas: PostgresSchema[] = meta.schemas.list()
- const [protectedSchemas, openSchemas] = partition(schemas, (schema) =>
- meta.excludedSchemas.includes(schema?.name ?? '')
++ const { data: schemas } = useSchemasQuery({
++ projectRef: project?.ref,
++ connectionString: project?.connectionString,
++ })
++ const [protectedSchemas, openSchemas] = partition(schemas ?? [], (schema) =>
++ EXCLUDED_SCHEMAS.includes(schema?.name ?? '')
+ )
- const schema = schemas.find((schema) => schema.name === selectedSchema)
++ const schema = schemas?.find((schema) => schema.name === selectedSchema)
+ const isLocked = protectedSchemas.some((s) => s.id === schema?.id)
+
+ const functions = meta.functions.list()
+
if (meta.functions.isLoading) {
- return (
- <div className="flex h-full w-full items-center justify-center space-x-2">
- <IconLoader className="animate-spin" size={14} />
- <p>Loading functions...</p>
- </div>
- )
+ return <GenericSkeletonLoader />
}
if (meta.functions.hasError) {
diff --cc studio/components/interfaces/Database/Tables/ColumnList.tsx
index c9ae40f7237,ab3888fcde2..05e06cead8b
--- a/studio/components/interfaces/Database/Tables/ColumnList.tsx
+++ b/studio/components/interfaces/Database/Tables/ColumnList.tsx
@@@ -4,13 -4,22 +4,22 @@@ import { PermissionAction } from '@supa
import { noop } from 'lodash'
import { observer } from 'mobx-react-lite'
import { useState } from 'react'
+
+import NoSearchResults from 'components/to-be-cleaned/NoSearchResults'
+import Table from 'components/to-be-cleaned/Table'
+import { useCheckPermissions, useStore } from 'hooks'
+import { EXCLUDED_SCHEMAS } from 'lib/constants/schemas'
- import { Button, IconChevronLeft, IconEdit3, IconPlus, IconSearch, IconTrash, Input } from 'ui'
+ import {
+ Button,
+ IconChevronLeft,
+ IconChevronRight,
+ IconEdit3,
+ IconPlus,
+ IconSearch,
+ IconTrash,
+ Input,
+ } from 'ui'
-import NoSearchResults from 'components/to-be-cleaned/NoSearchResults'
-import Table from 'components/to-be-cleaned/Table'
-import { useCheckPermissions, useStore } from 'hooks'
-import { ScaffoldHeader } from 'components/layouts/Scaffold'
-
interface ColumnListProps {
selectedTable: PostgresTable
onSelectBack: () => void
diff --cc studio/components/interfaces/Database/Tables/TableList.tsx
index ab30cf1cfee,999b193bb92..32c088159f9
--- a/studio/components/interfaces/Database/Tables/TableList.tsx
+++ b/studio/components/interfaces/Database/Tables/TableList.tsx
@@@ -4,15 -4,6 +4,14 @@@ import { PermissionAction } from '@supa
import { noop, partition } from 'lodash'
import { observer } from 'mobx-react-lite'
import { useState } from 'react'
+
+import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
- import NoSearchResults from 'components/to-be-cleaned/NoSearchResults'
+import Table from 'components/to-be-cleaned/Table'
- import ShimmeringLoader from 'components/ui/ShimmeringLoader'
++import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'
+import { useSchemasQuery } from 'data/database/schemas-query'
+import { useCheckPermissions, useStore } from 'hooks'
+import { EXCLUDED_SCHEMAS } from 'lib/constants/schemas'
+import { useTableEditorStateSnapshot } from 'state/table-editor'
import {
Button,
IconCheck,
@@@ -159,149 -159,174 +162,174 @@@ const TableList = (
)}
</div>
- {isLoading ? (
- <div className="py-4 space-y-2">
- <ShimmeringLoader />
- <ShimmeringLoader className="w-3/4" />
- <ShimmeringLoader className="w-1/2" />
- </div>
- ) : tables.length === 0 ? (
- <NoSearchResults />
- ) : (
- <div className="my-4 w-full">
- <Table
- head={[
- <Table.th key="name">Name</Table.th>,
- <Table.th key="description" className="hidden lg:table-cell">
- Description
- </Table.th>,
- <Table.th key="rows" className="hidden xl:table-cell">
- Rows (Estimated)
- </Table.th>,
- <Table.th key="size" className="hidden xl:table-cell">
- Size (Estimated)
- </Table.th>,
- <Table.th key="realtime" className="hidden xl:table-cell text-center">
- Realtime Enabled
- </Table.th>,
- <Table.th key="buttons"></Table.th>,
- ]}
- body={tables.map((x: any, i: any) => (
- <Table.tr key={x.id}>
- <Table.td>
- <p title={x.name}>{x.name}</p>
- </Table.td>
- <Table.td className="hidden max-w-sm truncate lg:table-cell break-all whitespace-normal">
- {x.comment !== null ? (
- <p title={x.comment}>{x.comment}</p>
- ) : (
- <p className="text-scale-800">No description</p>
+ <div className="my-4">
+ {isLoading ? (
+ <GenericSkeletonLoader />
+ ) : (
+ <div className="w-full">
+ <Table
+ head={[
+ <Table.th key="name">Name</Table.th>,
+ <Table.th key="description" className="hidden lg:table-cell">
+ Description
+ </Table.th>,
+ <Table.th key="rows" className="hidden xl:table-cell">
+ Rows (Estimated)
+ </Table.th>,
+ <Table.th key="size" className="hidden xl:table-cell">
+ Size (Estimated)
+ </Table.th>,
+ <Table.th key="realtime" className="hidden xl:table-cell text-center">
+ Realtime Enabled
+ </Table.th>,
+ <Table.th key="buttons"></Table.th>,
+ ]}
+ body={
+ <>
+ {tables.length === 0 && filterString.length === 0 && (
- <Table.tr key={selectedSchema}>
++ <Table.tr key={snap.selectedSchemaName}>
+ <Table.td colSpan={6}>
+ <p className="text-sm text-scale-1200">No tables created yet</p>
+ <p className="text-sm text-light">
- There are no tables found in the schema "{selectedSchema}"
++ There are no tables found in the schema "{snap.selectedSchemaName}"
+ </p>
+ </Table.td>
+ </Table.tr>
)}
- </Table.td>
- <Table.td className="hidden xl:table-cell">
- <code className="text-sm">{x.live_rows_estimate ?? x.live_row_count}</code>
- </Table.td>
- <Table.td className="hidden xl:table-cell">
- <code className="text-sm">{x.size}</code>
- </Table.td>
- <Table.td className="hidden xl:table-cell text-center">
- {(realtimePublication?.tables ?? []).find((table: any) => table.id === x.id) && (
- <div className="flex justify-center">
- <IconCheck strokeWidth={2} />
- </div>
+ {tables.length === 0 && filterString.length > 0 && (
- <Table.tr key={selectedSchema}>
++ <Table.tr key={snap.selectedSchemaName}>
+ <Table.td colSpan={6}>
+ <p className="text-sm text-scale-1200">No results found</p>
+ <p className="text-sm text-light">
+ Your search for "{filterString}" did not return any results
+ </p>
+ </Table.td>
+ </Table.tr>
)}
- </Table.td>
- <Table.td>
- <div className="flex justify-end gap-2">
- <Button
- type="default"
- iconRight={<IconColumns />}
- className="whitespace-nowrap hover:border-gray-500"
- style={{ paddingTop: 3, paddingBottom: 3 }}
- onClick={() => onOpenTable(x)}
- >
- {x.columns?.length} columns
- </Button>
-
- <Tooltip.Root delayDuration={0}>
- <Tooltip.Trigger>
- <Button
- type="text"
- icon={<IconEdit3 />}
- style={{ padding: 5 }}
- disabled={!canUpdateTables || isLocked}
- onClick={() => onEditTable(x)}
- />
- </Tooltip.Trigger>
- {!canUpdateTables && (
- <Tooltip.Portal>
- <Tooltip.Content side="bottom">
- <Tooltip.Arrow className="radix-tooltip-arrow" />
- <div
- className={[
- 'rounded bg-scale-100 py-1 px-2 leading-none shadow',
- 'border border-scale-200',
- ].join(' ')}
- >
- <span className="text-xs text-scale-1200">
- You need additional permissions to edit tables
- </span>
+ {tables.length > 0 &&
+ tables.map((x: any, i: any) => (
+ <Table.tr key={x.id}>
+ <Table.td>
+ <p title={x.name}>{x.name}</p>
+ </Table.td>
+ <Table.td className="hidden max-w-sm truncate lg:table-cell break-all whitespace-normal">
+ {x.comment !== null ? (
+ <p title={x.comment}>{x.comment}</p>
+ ) : (
+ <p className="text-scale-800">No description</p>
+ )}
+ </Table.td>
+ <Table.td className="hidden xl:table-cell">
+ <code className="text-sm">
+ {x.live_rows_estimate ?? x.live_row_count}
+ </code>
+ </Table.td>
+ <Table.td className="hidden xl:table-cell">
+ <code className="text-sm">{x.size}</code>
+ </Table.td>
+ <Table.td className="hidden xl:table-cell text-center">
+ {(realtimePublication?.tables ?? []).find(
+ (table: any) => table.id === x.id
+ ) && (
+ <div className="flex justify-center">
+ <IconCheck strokeWidth={2} />
</div>
- </Tooltip.Content>
- </Tooltip.Portal>
- )}
- </Tooltip.Root>
-
- <Tooltip.Root delayDuration={0}>
- <Tooltip.Trigger>
- <Button
- type="text"
- icon={<IconTrash />}
- style={{ padding: 5 }}
- disabled={!canUpdateTables || isLocked}
- onClick={() => onDeleteTable(x)}
- />
- </Tooltip.Trigger>
- {!canUpdateTables && (
- <Tooltip.Portal>
- <Tooltip.Content side="bottom">
- <Tooltip.Arrow className="radix-tooltip-arrow" />
- <div
- className={[
- 'rounded bg-scale-100 py-1 px-2 leading-none shadow',
- 'border border-scale-200',
- ].join(' ')}
+ )}
+ </Table.td>
+ <Table.td>
+ <div className="flex justify-end gap-2">
+ <Button
+ type="default"
+ iconRight={<IconColumns />}
+ className="whitespace-nowrap hover:border-gray-500"
+ style={{ paddingTop: 3, paddingBottom: 3 }}
+ onClick={() => onOpenTable(x)}
>
- <span className="text-xs text-scale-1200">
- You need additional permissions to delete tables
- </span>
- </div>
- </Tooltip.Content>
- </Tooltip.Portal>
- )}
- </Tooltip.Root>
+ {x.columns?.length} columns
+ </Button>
- {/* <Button
- type="text"
- icon={<IconEdit3 />}
- style={{ padding: 5 }}
- disabled={isLocked}
- onClick={() => onEditTable(x)}
- />
- <Button
- type="text"
- icon={<IconTrash />}
- style={{ padding: 5 }}
- disabled={isLocked}
- onClick={() => onDeleteTable(x)}
- /> */}
- </div>
- </Table.td>
- </Table.tr>
- ))}
- />
- </div>
- )}
+ <Tooltip.Root delayDuration={0}>
+ <Tooltip.Trigger>
+ <Button
+ type="text"
+ icon={<IconEdit3 />}
+ style={{ padding: 5 }}
+ disabled={!canUpdateTables || isLocked}
+ onClick={() => onEditTable(x)}
+ />
+ </Tooltip.Trigger>
+ {!canUpdateTables && (
+ <Tooltip.Portal>
+ <Tooltip.Content side="bottom">
+ <Tooltip.Arrow className="radix-tooltip-arrow" />
+ <div
+ className={[
+ 'rounded bg-scale-100 py-1 px-2 leading-none shadow',
+ 'border border-scale-200',
+ ].join(' ')}
+ >
+ <span className="text-xs text-scale-1200">
+ You need additional permissions to edit tables
+ </span>
+ </div>
+ </Tooltip.Content>
+ </Tooltip.Portal>
+ )}
+ </Tooltip.Root>
+
+ <Tooltip.Root delayDuration={0}>
+ <Tooltip.Trigger>
+ <Button
+ type="text"
+ icon={<IconTrash />}
+ style={{ padding: 5 }}
+ disabled={!canUpdateTables || isLocked}
+ onClick={() => onDeleteTable(x)}
+ />
+ </Tooltip.Trigger>
+ {!canUpdateTables && (
+ <Tooltip.Portal>
+ <Tooltip.Content side="bottom">
+ <Tooltip.Arrow className="radix-tooltip-arrow" />
+ <div
+ className={[
+ 'rounded bg-scale-100 py-1 px-2 leading-none shadow',
+ 'border border-scale-200',
+ ].join(' ')}
+ >
+ <span className="text-xs text-scale-1200">
+ You need additional permissions to delete tables
+ </span>
+ </div>
+ </Tooltip.Content>
+ </Tooltip.Portal>
+ )}
+ </Tooltip.Root>
+
+ {/* <Button
+ type="text"
+ icon={<IconEdit3 />}
+ style={{ padding: 5 }}
+ disabled={isLocked}
+ onClick={() => onEditTable(x)}
+ />
+ <Button
+ type="text"
+ icon={<IconTrash />}
+ style={{ padding: 5 }}
+ disabled={isLocked}
+ onClick={() => onDeleteTable(x)}
+ /> */}
+ </div>
+ </Table.td>
+ </Table.tr>
+ ))}
+ </>
+ }
+ />
+ </div>
+ )}
+ </div>
</>
)
}
diff --cc studio/components/interfaces/Database/Triggers/TriggersList/TriggersList.tsx
index adc2257e3aa,0f5bd314851..c0a18b31d05
--- a/studio/components/interfaces/Database/Triggers/TriggersList/TriggersList.tsx
+++ b/studio/components/interfaces/Database/Triggers/TriggersList/TriggersList.tsx
@@@ -1,18 -1,20 +1,22 @@@
- import { FC } from 'react'
- import { includes, uniqBy, map as lodashMap, noop } from 'lodash'
- import { observer } from 'mobx-react-lite'
import * as Tooltip from '@radix-ui/react-tooltip'
- import { Button, Input, IconSearch, IconLoader } from 'ui'
-import { PostgresSchema } from '@supabase/postgres-meta'
import { PermissionAction } from '@supabase/shared-types/out/constants'
+ import { noop, partition } from 'lodash'
+ import { observer } from 'mobx-react-lite'
+ import { useState } from 'react'
+ import { Button, IconLock, IconSearch, Input, Listbox } from 'ui'
- import { useCheckPermissions, useStore } from 'hooks'
- import SchemaTable from './SchemaTable'
++import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
import AlphaPreview from 'components/to-be-cleaned/AlphaPreview'
import ProductEmptyState from 'components/to-be-cleaned/ProductEmptyState'
+ import Table from 'components/to-be-cleaned/Table'
+ import AlertError from 'components/ui/AlertError'
+ import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader'
++import { useSchemasQuery } from 'data/database/schemas-query'
+ import { useCheckPermissions, useStore } from 'hooks'
++import { EXCLUDED_SCHEMAS } from 'lib/constants/schemas'
+ import TriggerList from './TriggerList'
interface TriggersListProps {
- filterString: string
- setFilterString: (value: string) => void
createTrigger: () => void
editTrigger: (trigger: any) => void
deleteTrigger: (trigger: any) => void
@@@ -25,12 -25,18 +27,22 @@@ const TriggersList = (
editTrigger = noop,
deleteTrigger = noop,
}: TriggersListProps) => {
++ const { project } = useProjectContext()
const { meta } = useStore()
- const triggers = meta.triggers.list()
- const filteredTriggers = triggers.filter((x: any) =>
- includes(x.name.toLowerCase(), filterString.toLowerCase())
+ const [selectedSchema, setSelectedSchema] = useState<string>('public')
+ const [filterString, setFilterString] = useState<string>('')
+
- const schemas: PostgresSchema[] = meta.schemas.list()
- const [protectedSchemas, openSchemas] = partition(schemas, (schema) =>
- meta.excludedSchemas.includes(schema?.name ?? '')
++ const { data: schemas } = useSchemasQuery({
++ projectRef: project?.ref,
++ connectionString: project?.connectionString,
++ })
++ const [protectedSchemas, openSchemas] = partition(schemas ?? [], (schema) =>
++ EXCLUDED_SCHEMAS.includes(schema?.name ?? '')
)
- const filteredTriggerSchemas = lodashMap(uniqBy(filteredTriggers, 'schema'), 'schema')
- const schema = schemas.find((schema) => schema.name === selectedSchema)
++ const schema = schemas?.find((schema) => schema.name === selectedSchema)
+ const isLocked = protectedSchemas.some((s) => s.id === schema?.id)
+
+ const triggers = meta.triggers.list()
const canCreateTriggers = useCheckPermissions(PermissionAction.TENANT_SQL_ADMIN_WRITE, 'triggers')
if (meta.triggers.isLoading) {
diff --cc studio/components/layouts/DatabaseLayout/DatabaseLayout.tsx
index ab2ead4814f,68d87ffa499..d8417263411
--- a/studio/components/layouts/DatabaseLayout/DatabaseLayout.tsx
+++ b/studio/components/layouts/DatabaseLayout/DatabaseLayout.tsx
@@@ -4,9 -4,7 +4,8 @@@ import { PropsWithChildren, useEffect,
import Error from 'components/ui/Error'
import ProductMenu from 'components/ui/ProductMenu'
+import { useSchemasQuery } from 'data/database/schemas-query'
import { useSelectedProject, useStore, withAuth } from 'hooks'
- import { IS_PLATFORM } from 'lib/constants'
import ProjectLayout from '../'
import { generateDatabaseMenu } from './DatabaseMenu.utils'
@@@ -15,12 -13,8 +14,12 @@@ export interface DatabaseLayoutProps
}
const DatabaseLayout = ({ children }: PropsWithChildren<DatabaseLayoutProps>) => {
- const { ui, meta, vault, backups } = useStore()
+ const { ui, meta, vault } = useStore()
- const { isLoading: isSchemasLoading } = meta.schemas
+ const project = useSelectedProject()
+ const { isLoading: isSchemasLoading } = useSchemasQuery({
+ projectRef: project?.ref,
+ connectionString: project?.connectionString,
+ })
const { isLoading: isVaultLoading } = vault
const { isInitialized, error } = meta.tables
diff --cc studio/data/database/keys.ts
index cf132f43b30,4d75d55bee4..bd6aa6f2741
--- a/studio/data/database/keys.ts
+++ b/studio/data/database/keys.ts
@@@ -1,7 -1,5 +1,8 @@@
export const databaseKeys = {
+ schemaList: (projectRef: string | undefined) => ['projects', projectRef, 'schemas'] as const,
+ schema: (projectRef: string | undefined, id: string | undefined) =>
+ ['projects', projectRef, 'schemas', id] as const,
+ backups: (projectRef: string | undefined) => [projectRef, 'database', 'backups'] as const,
poolingConfiguration: (projectRef: string | undefined) =>
[projectRef, 'database', 'pooling-configuration'] as const,
}
diff --cc studio/pages/project/[ref]/database/hooks.tsx
index 80843408841,c7477d9d259..121004351a1
--- a/studio/pages/project/[ref]/database/hooks.tsx
+++ b/studio/pages/project/[ref]/database/hooks.tsx
@@@ -1,14 -1,14 +1,14 @@@
import { PermissionAction } from '@supabase/shared-types/out/constants'
--import clsx from 'clsx'
-import { useParams } from 'common'
import { observer } from 'mobx-react-lite'
import { useEffect, useState } from 'react'
-import { IconLoader } from 'ui'
+import { useParams } from 'common'
import DeleteHookModal from 'components/interfaces/Database/Hooks/DeleteHookModal'
import EditHookPanel from 'components/interfaces/Database/Hooks/EditHookPanel'
import HooksList from 'components/interfaces/Database/Hooks/HooksList/HooksList'
import { DatabaseLayout } from 'components/layouts'
+import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'
++import { ScaffoldContainer, ScaffoldSection } from 'components/layouts/Scaffold'
import ProductEmptyState from 'components/to-be-cleaned/ProductEmptyState'
import NoPermission from 'components/ui/NoPermission'
import { useHooksEnableMutation } from 'data/database/hooks-enable-mutation'
diff --cc studio/pages/project/[ref]/database/tables.tsx
index 31027fec6c7,a37cf910e14..23b9657c149
--- a/studio/pages/project/[ref]/database/tables.tsx
+++ b/studio/pages/project/[ref]/database/tables.tsx
@@@ -141,24 -143,31 +142,29 @@@ const DatabaseTables: NextPageWithLayou
return (
<>
- <div className="p-4">
- {isUndefined(selectedTable) ? (
- <TableList
- onAddTable={onAddTable}
- onEditTable={onEditTable}
- onDeleteTable={onDeleteTable}
- onOpenTable={setSelectedTable}
- />
- ) : (
- <ColumnList
- selectedTable={selectedTable}
- onAddColumn={onAddColumn}
- onEditColumn={onEditColumn}
- onDeleteColumn={onDeleteColumn}
- onSelectBack={() => setSelectedTable(undefined)}
- />
- )}
- </div>
+ <ScaffoldContainer>
+ <ScaffoldSection>
+ <div className="col-span-12">
+ {isUndefined(selectedTable) ? (
+ <TableList
- selectedSchema={selectedSchema}
- onSelectSchema={setSelectedSchema}
+ onAddTable={onAddTable}
+ onEditTable={onEditTable}
+ onDeleteTable={onDeleteTable}
+ onOpenTable={setSelectedTable}
+ />
+ ) : (
+ <ColumnList
+ selectedTable={selectedTable}
+ onAddColumn={onAddColumn}
+ onEditColumn={onEditColumn}
+ onDeleteColumn={onDeleteColumn}
+ onSelectBack={() => setSelectedTable(undefined)}
+ />
+ )}
+ </div>
+ </ScaffoldSection>
+ </ScaffoldContainer>
+
<ConfirmationModal
danger
visible={isDeleting && !isUndefined(selectedTableToDelete)}
@@@ -191,8 -201,10 +198,9 @@@
</p>
</Modal.Content>
</ConfirmationModal>
+
<SidePanelEditor
sidePanelKey={sidePanelKey}
- selectedSchema={selectedSchema}
selectedTable={selectedTable}
onColumnSaved={onColumnUpdated}
closePanel={onClosePanel}