Skip to content

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

Make grid editable for non public schemas

Joshen Limab819041ac08
diff --git a/studio/components/interfaces/TableGridEditor/TableGridEditor.tsx b/studio/components/interfaces/TableGridEditor/TableGridEditor.tsx
index 085a3fbe76d..36fdf52627a 100644
--- a/studio/components/interfaces/TableGridEditor/TableGridEditor.tsx
+++ b/studio/components/interfaces/TableGridEditor/TableGridEditor.tsx
@@ -66,6 +66,8 @@ const TableGridEditor: FC<Props> = ({
const tableId = selectedTable?.id
const isViewSelected = Object.keys(selectedTable).length === 2
+ const isLocked = meta.excludedSchemas.includes(selectedSchema || '')
+
const gridTable = !isViewSelected
? parseSupaTable({
table: selectedTable as PostgresTable,
@@ -102,6 +104,7 @@ const TableGridEditor: FC<Props> = ({
// For some reason, selectedTable here is stale after adding a table
// temporary workaround is to list grab the selected table again
const tables: PostgresTable[] = meta.tables.list()
+ // @ts-ignore
const table = tables.find((table) => table.id === Number(tableId))
const column = find(table!.columns, { name }) as PostgresColumn
if (column) {
@@ -135,11 +138,14 @@ const TableGridEditor: FC<Props> = ({
theme={theme}
gridProps={{ height: '100%' }}
storageRef={projectRef}
- editable={!isViewSelected && selectedTable.schema === 'public'}
+ editable={!isViewSelected && !isLocked}
schema={selectedTable.schema}
table={gridTable}
headerActions={
- !isViewSelected && selectedTable.schema === 'public' && <GridHeaderActions table={selectedTable as PostgresTable} />
+ !isViewSelected &&
+ selectedTable.schema === 'public' && (
+ <GridHeaderActions table={selectedTable as PostgresTable} />
+ )
}
onAddColumn={onAddColumn}
onEditColumn={onSelectEditColumn}