The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Lock schemas that are owned by supabase_admin, in studio
Joshen Lim74c33be50f51
diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.tsx b/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.tsxindex e1403753d2d..8664cbfb1c3 100644--- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.tsx+++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.tsx@@ -182,6 +182,7 @@ const SidePanelEditor: FC<Props> = ({category: 'loading',message: `Creating new table: ${payload.name}...`,})+const table = await meta.createTable(toastId,payload,diff --git a/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.tsx b/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.tsxindex 990796f0f8b..70596281882 100644--- a/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.tsx+++ b/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.tsx@@ -141,6 +141,7 @@ const TableEditor: FC<Props> = ({isRealtimeEnabled: tableFields.isRealtimeEnabled,isDuplicateRows: isDuplicateRows,}+saveChanges(payload, columns, isNewRecord, configuration, resolve)} else {resolve()diff --git a/studio/components/interfaces/TableGridEditor/TableGridEditor.tsx b/studio/components/interfaces/TableGridEditor/TableGridEditor.tsxindex 36fdf52627a..c7fbe5a7223 100644--- a/studio/components/interfaces/TableGridEditor/TableGridEditor.tsx+++ b/studio/components/interfaces/TableGridEditor/TableGridEditor.tsx@@ -64,9 +64,10 @@ const TableGridEditor: FC<Props> = ({}const tableId = selectedTable?.id-+ // @ts-ignore+ const schema = meta.schemas.list().find((schema) => schema.name === selectedSchema)const isViewSelected = Object.keys(selectedTable).length === 2- const isLocked = meta.excludedSchemas.includes(selectedSchema || '')+ const isLocked = schema?.owner === 'supabase_admin'const gridTable = !isViewSelected? parseSupaTable({diff --git a/studio/components/layouts/TableEditorLayout/TableEditorMenu.tsx b/studio/components/layouts/TableEditorLayout/TableEditorMenu.tsxindex ef8b37d2458..d1eaf17d847 100644--- a/studio/components/layouts/TableEditorLayout/TableEditorMenu.tsx+++ b/studio/components/layouts/TableEditorLayout/TableEditorMenu.tsx@@ -1,6 +1,7 @@import { FC, useState, useEffect } from 'react'import { useRouter } from 'next/router'import Link from 'next/link'+import { partition } from 'lodash'import {Button,Dropdown,@@ -47,12 +48,18 @@ const TableEditorMenu: FC<Props> = ({const { id } = router.queryconst projectRef = ui.selectedProject?.ref+ const schemas: PostgresSchema[] = meta.schemas.list()+ const tables: PostgresTable[] = meta.tables.list(+ (table: PostgresTable) => table.schema === selectedSchema+ )++ // @ts-ignore+ const schema = schemas.find((schema) => schema.name === selectedSchema)+const [searchText, setSearchText] = useState<string>('')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(() => {@@ -75,11 +82,6 @@ const TableEditorMenu: FC<Props> = ({setIsRefreshing(false)}- const schemas: PostgresSchema[] = meta.schemas.list()- const tables: PostgresTable[] = meta.tables.list(- (table: PostgresTable) => table.schema === selectedSchema- )-const schemaTables =searchText.length === 0? tables@@ -91,6 +93,12 @@ const TableEditorMenu: FC<Props> = ({? schemaViews: schemaViews.filter((view) => view.name.includes(searchText))+ const isLocked = schema?.owner === 'supabase_admin'+ const [protectedSchemas, openSchemas] = partition(+ schemas,+ (schema) => schema.owner === 'supabase_admin'+ )+return (<div className="my-6 mx-4 flex flex-grow flex-col space-y-6">{/* Schema selection dropdown */}@@ -111,7 +119,29 @@ const TableEditorMenu: FC<Props> = ({onSelectSchema(name)}}>- {schemas.map((schema) => (+ <Listbox.Option disabled key="normal-schemas" value="normal-schemas" label="Schemas">+ <p className="text-sm">Schemas</p>+ </Listbox.Option>+ {openSchemas.map((schema) => (+ <Listbox.Option+ key={schema.id}+ value={schema.name}+ // @ts-ignore+ label={schema.name}+ addOnBefore={() => <span className="text-scale-900">schema</span>}+ >+ <span className="text-scale-1200 text-sm">{schema.name}</span>+ </Listbox.Option>+ ))}+ <Listbox.Option+ disabled+ key="protected-schemas"+ value="protected-schemas"+ label="Protected schemas"+ >+ <p className="text-sm">Protected schemas</p>+ </Listbox.Option>+ {protectedSchemas.map((schema) => (<Listbox.Optionkey={schema.id}value={schema.name}