Skip to content

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

Update logic for protected schemas

Joshen Lima746804ac11b
diff --git a/studio/components/interfaces/TableGridEditor/TableGridEditor.tsx b/studio/components/interfaces/TableGridEditor/TableGridEditor.tsx
index c7fbe5a7223..6265165ac2f 100644
--- a/studio/components/interfaces/TableGridEditor/TableGridEditor.tsx
+++ b/studio/components/interfaces/TableGridEditor/TableGridEditor.tsx
@@ -67,7 +67,7 @@ const TableGridEditor: FC<Props> = ({
// @ts-ignore
const schema = meta.schemas.list().find((schema) => schema.name === selectedSchema)
const isViewSelected = Object.keys(selectedTable).length === 2
- const isLocked = schema?.owner === 'supabase_admin'
+ const isLocked = meta.excludedSchemas.includes(schema?.name ?? '')
const gridTable = !isViewSelected
? parseSupaTable({
diff --git a/studio/components/layouts/TableEditorLayout/TableEditorMenu.tsx b/studio/components/layouts/TableEditorLayout/TableEditorMenu.tsx
index d1eaf17d847..b4448ad1c72 100644
--- a/studio/components/layouts/TableEditorLayout/TableEditorMenu.tsx
+++ b/studio/components/layouts/TableEditorLayout/TableEditorMenu.tsx
@@ -93,11 +93,10 @@ 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'
+ const [protectedSchemas, openSchemas] = partition(schemas, (schema) =>
+ meta.excludedSchemas.includes(schema?.name ?? '')
)
+ const isLocked = protectedSchemas.some((s) => s.id === schema?.id)
return (
<div className="my-6 mx-4 flex flex-grow flex-col space-y-6">
diff --git a/studio/stores/pgmeta/MetaStore.ts b/studio/stores/pgmeta/MetaStore.ts
index 986680b48dc..901c926650b 100644
--- a/studio/stores/pgmeta/MetaStore.ts
+++ b/studio/stores/pgmeta/MetaStore.ts
@@ -135,6 +135,8 @@ export default class MetaStore implements IMetaStore {
projectRef?: string
connectionString?: string
baseUrl: string
+
+ // [Joshen] I'm going to treat this as a list of system schemas
excludedSchemas = [
'auth',
'extensions',
@@ -146,6 +148,7 @@ export default class MetaStore implements IMetaStore {
'storage',
'supabase_functions',
'graphql',
+ 'graphql_public',
]
constructor(rootStore: IRootStore, options: { projectRef: string; connectionString: string }) {