Skip to content

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

chore(studio): drop @supabase/postgres-meta in favor of @supabase/pg-meta (#45844)

Charisd4079083fc09
diff --git a/apps/studio/components/grid/components/formatter/ForeignKeyFormatter.tsx b/apps/studio/components/grid/components/formatter/ForeignKeyFormatter.tsx
index 51c5582ea39..6ad1debd533 100644
--- a/apps/studio/components/grid/components/formatter/ForeignKeyFormatter.tsx
+++ b/apps/studio/components/grid/components/formatter/ForeignKeyFormatter.tsx
@@ -1,4 +1,4 @@
-import type { PostgresTable } from '@supabase/postgres-meta'
+import type { PGTable } from '@supabase/pg-meta'
import { ArrowRight } from 'lucide-react'
import type { PropsWithChildren } from 'react'
import type { RenderCellProps } from 'react-data-grid'
@@ -38,7 +38,7 @@ export const ForeignKeyFormatter = (props: Props) => {
r.source_column_name === column.name
)
- const { data: targetTable, isPending: isLoadingTargetTable } = useTableQuery<PostgresTable>(
+ const { data: targetTable, isPending: isLoadingTargetTable } = useTableQuery<PGTable>(
{
projectRef: project?.ref,
connectionString: project?.connectionString,
diff --git a/apps/studio/components/grid/components/formatter/ReferenceRecordPeek.tsx b/apps/studio/components/grid/components/formatter/ReferenceRecordPeek.tsx
index 0d7e1043991..ace88f95002 100644
--- a/apps/studio/components/grid/components/formatter/ReferenceRecordPeek.tsx
+++ b/apps/studio/components/grid/components/formatter/ReferenceRecordPeek.tsx
@@ -1,4 +1,4 @@
-import { PostgresTable } from '@supabase/postgres-meta'
+import type { PGTable } from '@supabase/pg-meta'
import { keepPreviousData } from '@tanstack/react-query'
import { useParams } from 'common'
import { Key } from 'lucide-react'
@@ -29,7 +29,7 @@ import { useTableRowsQuery } from '@/data/table-rows/table-rows-query'
import { useSelectedProjectQuery } from '@/hooks/misc/useSelectedProject'
interface ReferenceRecordPeekProps {
- table: PostgresTable
+ table: PGTable
column: string
value: string | number | Record<string, unknown>
}
diff --git a/apps/studio/components/grid/components/grid/Grid.tsx b/apps/studio/components/grid/components/grid/Grid.tsx
index 0e014d5160c..f6df2b27017 100644
--- a/apps/studio/components/grid/components/grid/Grid.tsx
+++ b/apps/studio/components/grid/components/grid/Grid.tsx
@@ -1,6 +1,6 @@
import { DndContext, DragOverlay, PointerSensor, useSensor, useSensors } from '@dnd-kit/core'
import { horizontalListSortingStrategy, SortableContext } from '@dnd-kit/sortable'
-import type { PostgresColumn } from '@supabase/postgres-meta'
+import type { PGColumn } from '@supabase/pg-meta'
import { forwardRef, memo, Ref, useCallback, useMemo, useRef, useState } from 'react'
import DataGrid, {
CalculatedColumn,
@@ -137,7 +137,7 @@ export const Grid = memo(
tableEditorSnap.onEditForeignKeyColumnValue({
foreignKey,
row,
- column: column as unknown as PostgresColumn,
+ column: column as unknown as PGColumn,
})
}
}
diff --git a/apps/studio/components/interfaces/Auth/Policies/Policies.utils.ts b/apps/studio/components/interfaces/Auth/Policies/Policies.utils.ts
index 13ad83f6b83..81f38781a7d 100644
--- a/apps/studio/components/interfaces/Auth/Policies/Policies.utils.ts
+++ b/apps/studio/components/interfaces/Auth/Policies/Policies.utils.ts
@@ -1,5 +1,5 @@
+import type { PGPolicy } from '@supabase/pg-meta'
import { ident } from '@supabase/pg-meta/src/pg-format'
-import type { PostgresPolicy } from '@supabase/postgres-meta'
import { has, isEmpty, isEqual } from 'lodash'
import {
@@ -19,7 +19,7 @@ import type { ForeignKeyConstraint } from '@/data/database/foreign-key-constrain
export const createSQLPolicy = (
policyFormFields: PolicyFormField,
- originalPolicyFormFields?: PostgresPolicy
+ originalPolicyFormFields?: PGPolicy
) => {
const { definition, check } = policyFormFields
const formattedPolicyFormFields = {
@@ -129,7 +129,7 @@ export const createPayloadForCreatePolicy = (
export const createPayloadForUpdatePolicy = (
policyFormFields: PolicyFormField,
- originalPolicyFormFields: PostgresPolicy
+ originalPolicyFormFields: PGPolicy
): PostgresPolicyUpdatePayload => {
const { definition, check } = policyFormFields
const formattedPolicyFormFields = {
diff --git a/apps/studio/components/interfaces/Auth/Policies/PolicyEditorModal/index.tsx b/apps/studio/components/interfaces/Auth/Policies/PolicyEditorModal/index.tsx
index 2f43e92d505..3076480255e 100644
--- a/apps/studio/components/interfaces/Auth/Policies/PolicyEditorModal/index.tsx
+++ b/apps/studio/components/interfaces/Auth/Policies/PolicyEditorModal/index.tsx
@@ -1,4 +1,4 @@
-import { PostgresPolicy } from '@supabase/postgres-meta'
+import type { PGPolicy } from '@supabase/pg-meta'
import { isEmpty, noop } from 'lodash'
import { useCallback, useEffect, useState } from 'react'
import { toast } from 'sonner'
@@ -32,7 +32,7 @@ interface PolicyEditorModalProps {
visible?: boolean
schema?: string
table?: string
- selectedPolicyToEdit?: PostgresPolicy
+ selectedPolicyToEdit?: PGPolicy
showAssistantPreview?: boolean
onSelectCancel: () => void
onCreatePolicy: (payload: PostgresPolicyCreatePayload) => Promise<boolean>
diff --git a/apps/studio/components/interfaces/Auth/Policies/PolicyEditorPanel/LockedQuerySection.tsx b/apps/studio/components/interfaces/Auth/Policies/PolicyEditorPanel/LockedQuerySection.tsx
index 6f5d5aa5a0b..fea81efb341 100644
--- a/apps/studio/components/interfaces/Auth/Policies/PolicyEditorPanel/LockedQuerySection.tsx
+++ b/apps/studio/components/interfaces/Auth/Policies/PolicyEditorPanel/LockedQuerySection.tsx
@@ -1,9 +1,9 @@
-import { PostgresPolicy } from '@supabase/postgres-meta'
+import type { PGPolicy } from '@supabase/pg-meta'
import { Lock } from 'lucide-react'
interface LockedCreateQuerySection {
schema: string
- selectedPolicy?: PostgresPolicy
+ selectedPolicy?: PGPolicy
isRenamingPolicy: boolean
formFields: { name: string; table: string; behavior: string; command: string; roles: string }
}
diff --git a/apps/studio/components/interfaces/Auth/Policies/PolicyEditorPanel/PolicyEditorPanel.utils.ts b/apps/studio/components/interfaces/Auth/Policies/PolicyEditorPanel/PolicyEditorPanel.utils.ts
index f4a77e9c52e..f0341e8a06b 100644
--- a/apps/studio/components/interfaces/Auth/Policies/PolicyEditorPanel/PolicyEditorPanel.utils.ts
+++ b/apps/studio/components/interfaces/Auth/Policies/PolicyEditorPanel/PolicyEditorPanel.utils.ts
@@ -1,9 +1,9 @@
+import type { PGPolicy } from '@supabase/pg-meta'
import { ident, keyword, safeSql, type SafeSqlFragment } from '@supabase/pg-meta/src/pg-format'
-import type { PostgresPolicy } from '@supabase/postgres-meta'
import { isEqual } from 'lodash'
// [Joshen] Not used but keeping this for now in case we do an inline editor
-export const generatePlaceholder = (policy?: PostgresPolicy) => {
+export const generatePlaceholder = (policy?: PGPolicy) => {
if (policy === undefined) {
return `
-- Press tab to use this code\n
@@ -78,7 +78,7 @@ export const generateCreatePolicyQuery = ({
}
export const checkIfPolicyHasChanged = (
- selectedPolicy: PostgresPolicy,
+ selectedPolicy: PGPolicy,
policyForm: {
name: string
roles: string[]
diff --git a/apps/studio/components/interfaces/Auth/Policies/PolicyEditorPanel/PolicyEditorPanelHeader.tsx b/apps/studio/components/interfaces/Auth/Policies/PolicyEditorPanel/PolicyEditorPanelHeader.tsx
index 4ac4b166872..52967a692ac 100644
--- a/apps/studio/components/interfaces/Auth/Policies/PolicyEditorPanel/PolicyEditorPanelHeader.tsx
+++ b/apps/studio/components/interfaces/Auth/Policies/PolicyEditorPanel/PolicyEditorPanelHeader.tsx
@@ -1,4 +1,4 @@
-import type { PostgresPolicy } from '@supabase/postgres-meta'
+import type { PGPolicy } from '@supabase/pg-meta'
import { ChevronDown, PanelLeftClose, PanelRightClose, X } from 'lucide-react'
import { useState } from 'react'
import {
@@ -19,7 +19,7 @@ export const PolicyEditorPanelHeader = ({
showTools,
setShowTools,
}: {
- selectedPolicy?: PostgresPolicy
+ selectedPolicy?: PGPolicy
showTools: boolean
setShowTools: (v: boolean) => void
}) => {
diff --git a/apps/studio/components/interfaces/Auth/Policies/PolicyEditorPanel/PolicyTemplates.tsx b/apps/studio/components/interfaces/Auth/Policies/PolicyEditorPanel/PolicyTemplates.tsx
index b5f7afb781e..57655955d15 100644
--- a/apps/studio/components/interfaces/Auth/Policies/PolicyEditorPanel/PolicyTemplates.tsx
+++ b/apps/studio/components/interfaces/Auth/Policies/PolicyEditorPanel/PolicyTemplates.tsx
@@ -1,4 +1,4 @@
-import { PostgresPolicy } from '@supabase/postgres-meta'
+import type { PGPolicy } from '@supabase/pg-meta'
import { Search } from 'lucide-react'
import { useState } from 'react'
import {
@@ -26,7 +26,7 @@ import { NoSearchResults } from '@/components/ui/NoSearchResults'
interface PolicyTemplatesProps {
schema: string
table: string
- selectedPolicy?: PostgresPolicy
+ selectedPolicy?: PGPolicy
selectedTemplate?: string
onSelectTemplate: (template: any) => void
}
diff --git a/apps/studio/components/interfaces/Auth/Policies/PolicyTableRow/PolicyTableRow.utils.ts b/apps/studio/components/interfaces/Auth/Policies/PolicyTableRow/PolicyTableRow.utils.ts
index d563e081ea3..5dcf3033906 100644
--- a/apps/studio/components/interfaces/Auth/Policies/PolicyTableRow/PolicyTableRow.utils.ts
+++ b/apps/studio/components/interfaces/Auth/Policies/PolicyTableRow/PolicyTableRow.utils.ts
@@ -1,9 +1,9 @@
import { ident, joinSqlFragments, safeSql, type SafeSqlFragment } from '@supabase/pg-meta'
-import { PostgresPolicy } from '@supabase/postgres-meta'
+import type { PGPolicy } from '@supabase/pg-meta'
import type { TableApiAccessData } from '@/data/privileges/table-api-access-query'
-export type Policy = Omit<PostgresPolicy, 'definition' | 'check'> & {
+export type Policy = Omit<PGPolicy, 'definition' | 'check'> & {
definition: SafeSqlFragment | null
check: SafeSqlFragment | null
}
diff --git a/apps/studio/components/interfaces/Database/Hooks/EditHookPanel.tsx b/apps/studio/components/interfaces/Database/Hooks/EditHookPanel.tsx
index 15df1516561..0904ead49c3 100644
--- a/apps/studio/components/interfaces/Database/Hooks/EditHookPanel.tsx
+++ b/apps/studio/components/interfaces/Database/Hooks/EditHookPanel.tsx
@@ -1,7 +1,6 @@
import { zodResolver } from '@hookform/resolvers/zod'
import { keyword } from '@supabase/pg-meta'
-import { PGTriggerCreate } from '@supabase/pg-meta/src/pg-meta-triggers'
-import type { PostgresTrigger } from '@supabase/postgres-meta'
+import type { PGTrigger, PGTriggerCreate } from '@supabase/pg-meta'
import { useQueryClient } from '@tanstack/react-query'
import { useParams } from 'common'
import { parseAsBoolean, parseAsString, useQueryState } from 'nuqs'
@@ -37,7 +36,7 @@ export const isEdgeFunction = ({
const FORM_ID = 'edit-hook-panel-form'
-const parseHeaders = (selectedHook?: PostgresTrigger): HTTPArgument[] => {
+const parseHeaders = (selectedHook?: PGTrigger): HTTPArgument[] => {
if (typeof selectedHook === 'undefined') {
return [{ id: uuidv4(), name: 'Content-type', value: 'application/json' }]
}
@@ -57,7 +56,7 @@ const parseHeaders = (selectedHook?: PostgresTrigger): HTTPArgument[] => {
}))
}
-const parseParameters = (selectedHook?: PostgresTrigger): HTTPArgument[] => {
+const parseParameters = (selectedHook?: PGTrigger): HTTPArgument[] => {
if (typeof selectedHook === 'undefined') {
return [{ id: uuidv4(), name: '', value: '' }]
}
diff --git a/apps/studio/components/interfaces/Database/Hooks/FormContents.tsx b/apps/studio/components/interfaces/Database/Hooks/FormContents.tsx
index 4ecb2497494..f081481aba3 100644
--- a/apps/studio/components/interfaces/Database/Hooks/FormContents.tsx
+++ b/apps/studio/components/interfaces/Database/Hooks/FormContents.tsx
@@ -1,4 +1,4 @@
-import type { PostgresTrigger } from '@supabase/postgres-meta'
+import type { PGTrigger } from '@supabase/pg-meta'
import { PermissionAction } from '@supabase/shared-types/out/constants'
import { useParams } from 'common'
import Image from 'next/legacy/image'
@@ -42,7 +42,7 @@ import { uuidv4 } from '@/lib/helpers'
export interface FormContentsProps {
form: UseFormReturn<WebhookFormValues>
- selectedHook?: PostgresTrigger
+ selectedHook?: PGTrigger
}
export const FormContents = ({ form, selectedHook }: FormContentsProps) => {
diff --git a/apps/studio/components/interfaces/Database/Publications/PublicationsTableItem.tsx b/apps/studio/components/interfaces/Database/Publications/PublicationsTableItem.tsx
index 4c732907d9f..df2e4f2685f 100644
--- a/apps/studio/components/interfaces/Database/Publications/PublicationsTableItem.tsx
+++ b/apps/studio/components/interfaces/Database/Publications/PublicationsTableItem.tsx
@@ -1,4 +1,4 @@
-import type { PostgresPublication, PostgresTable } from '@supabase/postgres-meta'
+import type { PGPublication, PGTable } from '@supabase/pg-meta'
import { PermissionAction } from '@supabase/shared-types/out/constants'
import { useState } from 'react'
import { toast } from 'sonner'
@@ -10,8 +10,8 @@ import { useSelectedProjectQuery } from '@/hooks/misc/useSelectedProject'
import { useProtectedSchemas } from '@/hooks/useProtectedSchemas'
interface PublicationsTableItemProps {
- table: PostgresTable
- selectedPublication: PostgresPublication
+ table: PGTable
+ selectedPublication: PGPublication
}
export const PublicationsTableItem = ({
@@ -35,10 +35,7 @@ export const PublicationsTableItem = ({
const { mutate: updatePublications, isPending } = useDatabasePublicationUpdateMutation()
- const toggleReplicationForTable = async (
- table: PostgresTable,
- publication: PostgresPublication
- ) => {
+ const toggleReplicationForTable = async (table: PGTable, publication: PGPublication) => {
if (project === undefined) return console.error('Project is required')
const originalChecked = checked
diff --git a/apps/studio/components/interfaces/Database/Schemas/SchemaGraph.tsx b/apps/studio/components/interfaces/Database/Schemas/SchemaGraph.tsx
index 3ea45e0170b..ec14624c487 100644
--- a/apps/studio/components/interfaces/Database/Schemas/SchemaGraph.tsx
+++ b/apps/studio/components/interfaces/Database/Schemas/SchemaGraph.tsx
@@ -1,4 +1,4 @@
-import type { PostgresSchema, PostgresTable } from '@supabase/postgres-meta'
+import type { PGSchema, PGTable } from '@supabase/pg-meta'
import { PermissionAction } from '@supabase/shared-types/out/constants'
import {
Background,
@@ -75,7 +75,7 @@ export const SchemaGraph = () => {
const { resolvedTheme } = useTheme()
const { data: project } = useSelectedProjectQuery()
const { selectedSchema, setSelectedSchema } = useQuerySchemaState()
- const [selectedTable, setSelectedTable] = useState<PostgresTable | null>(null)
+ const [selectedTable, setSelectedTable] = useState<PGTable | null>(null)
const snap = useTableEditorStateSnapshot()
const { isDownloading, exportSchemaToImage } = useExportSchemaToImage()
@@ -241,7 +241,7 @@ export const SchemaGraph = () => {
const isFirstLoad = useRef(true)
useEffect(() => {
if (isSuccessTables && isSuccessSchemas && tables.length > 0) {
- const schema = schemas.find((s) => s.name === selectedSchema) as PostgresSchema
+ const schema = schemas.find((s) => s.name === selectedSchema) as PGSchema
getGraphDataFromTables(ref as string, schema, tables).then(({ nodes, edges }) => {
reactFlowInstance.setNodes(nodes)
reactFlowInstance.setEdges(edges)
diff --git a/apps/studio/components/interfaces/Database/Schemas/Schemas.utils.ts b/apps/studio/components/interfaces/Database/Schemas/Schemas.utils.ts
index 50eea3ca24e..7089fae8093 100644
--- a/apps/studio/components/interfaces/Database/Schemas/Schemas.utils.ts
+++ b/apps/studio/components/interfaces/Database/Schemas/Schemas.utils.ts
@@ -1,5 +1,5 @@
import dagre from '@dagrejs/dagre'
-import type { PostgresSchema, PostgresTable } from '@supabase/postgres-meta'
+import type { PGSchema, PGTable } from '@supabase/pg-meta'
import { Edge, Node, Position } from '@xyflow/react'
import { uniqBy } from 'lodash'
@@ -16,8 +16,8 @@ const RANK_SEP = 50
export async function getGraphDataFromTables(
ref?: string,
- schema?: PostgresSchema,
- tables?: PostgresTable[]
+ schema?: PGSchema,
+ tables?: PGTable[]
): Promise<{
nodes: Node<TableNodeData>[]
edges: Edge[]
@@ -166,7 +166,7 @@ export async function getGraphDataFromTables(
}
function findTablesHandleIds(
- tables: PostgresTable[],
+ tables: PGTable[],
table_name: string,
column_name: string
): [string?, string?] {
diff --git a/apps/studio/components/interfaces/Database/Tables/ColumnList.tsx b/apps/studio/components/interfaces/Database/Tables/ColumnList.tsx
index 9b3bdacfe2d..59d22f78532 100644
--- a/apps/studio/components/interfaces/Database/Tables/ColumnList.tsx
+++ b/apps/studio/components/interfaces/Database/Tables/ColumnList.tsx
@@ -1,4 +1,4 @@
-import { PostgresColumn } from '@supabase/postgres-meta'
+import type { PGColumn } from '@supabase/pg-meta'
import { PermissionAction } from '@supabase/shared-types/out/constants'
import { useParams } from 'common'
import { noop } from 'lodash'
@@ -58,7 +58,7 @@ import { useAsyncCheckPermissions } from '@/hooks/misc/useCheckPermissions'
import { useSelectedProjectQuery } from '@/hooks/misc/useSelectedProject'
import { useIsProtectedSchema } from '@/hooks/useProtectedSchemas'
-const getColumnTypeAffordancePresentation = (column: PostgresColumn) => {
+const getColumnTypeAffordancePresentation = (column: PGColumn) => {
const { kind, label } = getColumnTypeAffordance(column.format)
const iconClassName = 'text-foreground-muted'
@@ -98,8 +98,8 @@ const getColumnTypeAffordancePresentation = (column: PostgresColumn) => {
interface ColumnListProps {
onAddColumn: () => void
- onEditColumn: (column: PostgresColumn) => void
- onDeleteColumn: (column: PostgresColumn) => void
+ onEditColumn: (column: PGColumn) => void
+ onDeleteColumn: (column: PGColumn) => void
}
export const ColumnList = ({
diff --git a/apps/studio/components/interfaces/Database/Tables/TableList.tsx b/apps/studio/components/interfaces/Database/Tables/TableList.tsx
index 47cbd65cf83..c185e8c0d4f 100644
--- a/apps/studio/components/interfaces/Database/Tables/TableList.tsx
+++ b/apps/studio/components/interfaces/Database/Tables/TableList.tsx
@@ -1,4 +1,4 @@
-import type { PostgresTable } from '@supabase/postgres-meta'
+import type { PGTable } from '@supabase/pg-meta'
import { PermissionAction } from '@supabase/shared-types/out/constants'
import { useParams } from 'common'
import { noop } from 'lodash'
@@ -60,9 +60,9 @@ import { useShortcut } from '@/state/shortcuts/useShortcut'
interface TableListProps {
onAddTable: () => void
- onEditTable: (table: PostgresTable) => void
- onDeleteTable: (table: PostgresTable) => void
- onDuplicateTable: (table: PostgresTable) => void
+ onEditTable: (table: PGTable) => void
+ onDeleteTable: (table: PGTable) => void
+ onDuplicateTable: (table: PGTable) => void
}
export const TableList = ({
diff --git a/apps/studio/components/interfaces/Database/Tables/Tables.utils.ts b/apps/studio/components/interfaces/Database/Tables/Tables.utils.ts
index 2e032162c76..6b19bcca627 100644
--- a/apps/studio/components/interfaces/Database/Tables/Tables.utils.ts
+++ b/apps/studio/components/interfaces/Database/Tables/Tables.utils.ts
@@ -1,5 +1,4 @@
-import { PostgresMaterializedView, PostgresTable, PostgresView } from '@supabase/postgres-meta'
-import { PostgresForeignTable } from '@supabase/postgres-meta/dist/lib/types'
+import type { PGForeignTable, PGMaterializedView, PGTable, PGView } from '@supabase/pg-meta'
import { ENTITY_TYPE } from '@/data/entity-types/entity-type-constants'
@@ -11,10 +10,10 @@ export const formatAllEntities = ({
materializedViews = [],
foreignTables = [],
}: {
- tables?: PostgresTable[]
- views?: PostgresView[]
- materializedViews?: PostgresMaterializedView[]
- foreignTables?: PostgresForeignTable[]
+ tables?: PGTable[]
+ views?: PGView[]
+ materializedViews?: PGMaterializedView[]
+ foreignTables?: PGForeignTable[]
}) => {
const formattedTables = tables.map((x) => {
return {
diff --git a/apps/studio/components/interfaces/Database/Triggers/DeleteTrigger.tsx b/apps/studio/components/interfaces/Database/Triggers/DeleteTrigger.tsx
index 7126cc2f5e8..37050c66e91 100644
--- a/apps/studio/components/interfaces/Database/Triggers/DeleteTrigger.tsx
+++ b/apps/studio/components/interfaces/Database/Triggers/DeleteTrigger.tsx
@@ -1,16 +1,16 @@
-import type { PostgresTrigger } from '@supabase/postgres-meta'
+import type { PGTrigger } from '@supabase/pg-meta'
import { TextConfirmModal } from '@/components/ui/TextConfirmModalWrapper'
import { useSelectedProjectQuery } from '@/hooks/misc/useSelectedProject'
interface DeleteTriggerProps {
- trigger?: PostgresTrigger
+ trigger?: PGTrigger
visible: boolean
setVisible: (value: string | null) => void
onDelete: (params: {
projectRef: string
connectionString?: string | null
- trigger: PostgresTrigger
+ trigger: PGTrigger
}) => void
isLoading: boolean
}
diff --git a/apps/studio/components/interfaces/Database/Triggers/TriggerSheet.tsx b/apps/studio/components/interfaces/Database/Triggers/TriggerSheet.tsx
index 1d3caaadbdf..7b722bbaf64 100644
--- a/apps/studio/components/interfaces/Database/Triggers/TriggerSheet.tsx
+++ b/apps/studio/components/interfaces/Database/Triggers/TriggerSheet.tsx
@@ -1,5 +1,5 @@
import { zodResolver } from '@hookform/resolvers/zod'
-import { PostgresTrigger } from '@supabase/postgres-meta'
+import type { PGTrigger } from '@supabase/pg-meta'
import { Terminal } from 'lucide-react'
import { useEffect, useState } from 'react'
import { SubmitHandler, useForm } from 'react-hook-form'
@@ -76,7 +76,7 @@ const defaultValues: z.infer<typeof FormSchema> = {
}
interface TriggerSheetProps {
- selectedTrigger?: PostgresTrigger
+ selectedTrigger?: PGTrigger
isDuplicatingTrigger?: boolean
open: boolean
onClose: () => void
diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.tsx b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.tsx
index 1f45bc1543d..58d8a8f2398 100644
--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.tsx
+++ b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.tsx
@@ -1,4 +1,4 @@
-import type { PostgresColumn, PostgresTable } from '@supabase/postgres-meta'
+import type { PGColumn, PGTable } from '@supabase/pg-meta'
import { useParams } from 'common'
import { isEmpty, noop } from 'lodash'
import { ExternalLink, Plus } from 'lucide-react'
@@ -65,8 +65,8 @@ import { useProtectedSchemas } from '@/hooks/useProtectedSchemas'
import { DOCS_URL } from '@/lib/constants'
export interface ColumnEditorProps {
- column?: Readonly<PostgresColumn>
- selectedTable: PostgresTable
+ column?: Readonly<PGColumn>
+ selectedTable: PGTable
visible: boolean
closePanel: () => void
saveChanges: (
diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.utils.ts b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.utils.ts
index 40c1ff7fe6d..068dfd55b77 100644
--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.utils.ts
+++ b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/ColumnEditor.utils.ts
@@ -1,5 +1,5 @@
import { FOREIGN_KEY_CASCADE_ACTION } from '@supabase/pg-meta'
-import type { PostgresColumn } from '@supabase/postgres-meta'
+import type { PGColumn } from '@supabase/pg-meta'
import { isNull } from 'lodash'
import { toast } from 'sonner'
@@ -57,7 +57,7 @@ export const generateColumnField = (
}
export const generateColumnFieldFromPostgresColumn = (
- column: PostgresColumn,
+ column: PGColumn,
table: RetrieveTableResult,
foreignKeys: ForeignKeyConstraint[]
): ColumnField => {
@@ -213,7 +213,7 @@ export const getForeignKeyUIState = (
}
export const getColumnForeignKey = (
- column: PostgresColumn,
+ column: PGColumn,
table: RetrieveTableResult,
foreignKeys: ForeignKeyConstraint[]
) => {
diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/HeaderTitle.tsx b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/HeaderTitle.tsx
index fbb2e7575ff..342cde8291f 100644
--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/HeaderTitle.tsx
+++ b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/ColumnEditor/HeaderTitle.tsx
@@ -1,8 +1,8 @@
-import type { PostgresColumn, PostgresTable } from '@supabase/postgres-meta'
+import type { PGColumn, PGTable } from '@supabase/pg-meta'
interface Props {
- table: PostgresTable
- column?: PostgresColumn
+ table: PGTable
+ column?: PGColumn
}
export const HeaderTitle = ({ table, column }: Props) => {
diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/ForeignKeySelector/ForeignKeySelector.tsx b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/ForeignKeySelector/ForeignKeySelector.tsx
index 8840bbb0b7a..2b24e6f45d6 100644
--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/ForeignKeySelector/ForeignKeySelector.tsx
+++ b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/ForeignKeySelector/ForeignKeySelector.tsx
@@ -1,5 +1,5 @@
import { FOREIGN_KEY_CASCADE_ACTION } from '@supabase/pg-meta'
-import type { PostgresTable } from '@supabase/postgres-meta'
+import type { PGTable } from '@supabase/pg-meta'
import { sortBy } from 'lodash'
import { ArrowRight, HelpCircle, Loader2, X } from 'lucide-react'
import { Fragment, useEffect, useState } from 'react'
@@ -90,7 +90,7 @@ export const ForeignKeySelector = ({
includeColumns: false,
})
- const { data: selectedTable, isLoading: isLoadingSelectedTable } = useTableQuery<PostgresTable>(
+ const { data: selectedTable, isLoading: isLoadingSelectedTable } = useTableQuery<PGTable>(
{
projectRef: project?.ref,
connectionString: project?.connectionString,
diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.tsx b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.tsx
index 2ad7f3b2812..dd349a2dd6a 100644
--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.tsx
+++ b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.tsx
@@ -1,4 +1,4 @@
-import type { PostgresTable } from '@supabase/postgres-meta'
+import type { PGTable } from '@supabase/pg-meta'
import { isEmpty, noop, partition } from 'lodash'
import { useEffect, useMemo, useState } from 'react'
import { Label_Shadcn_, SidePanel, Switch } from 'ui'
@@ -25,7 +25,7 @@ import type { Dictionary } from '@/types'
export interface RowEditorProps {
row?: Dictionary<any>
- selectedTable: PostgresTable
+ selectedTable: PGTable
visible: boolean
editable?: boolean
closePanel: () => void
diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.types.ts b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.types.ts
index 85040d800b3..f46ccd01f43 100644
--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.types.ts
+++ b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.types.ts
@@ -1,4 +1,4 @@
-import type { PostgresRelationship } from '@supabase/postgres-meta'
+import type { PGTableRelationship } from '@supabase/pg-meta'
export interface EditValue {
row?: any
@@ -14,7 +14,7 @@ export interface RowField {
enums: string[]
value: string | null | undefined
defaultValue: string | null
- foreignKey?: PostgresRelationship
+ foreignKey?: PGTableRelationship
isNullable: boolean
isIdentity: boolean
isPrimaryKey: boolean
diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.utils.ts b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.utils.ts
index 3831580fcdf..0d9da5a66ac 100644
--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.utils.ts
+++ b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/RowEditor/RowEditor.utils.ts
@@ -1,5 +1,5 @@
+import type { PGColumn, PGTable, PGTableRelationship } from '@supabase/pg-meta'
import { MAX_ARRAY_SIZE, MAX_CHARACTERS } from '@supabase/pg-meta/src/query/table-row-query'
-import type { PostgresColumn, PostgresRelationship, PostgresTable } from '@supabase/postgres-meta'
import dayjs from 'dayjs'
import { compact, isEqual, isString, isUndefined, omitBy } from 'lodash'
@@ -15,7 +15,7 @@ import type { RowField } from './RowEditor.types'
import { minifyJSON, tryParseJson } from '@/lib/helpers'
import type { Dictionary } from '@/types'
-const getRowValue = ({ column, row }: { column: PostgresColumn; row?: Dictionary<any> }) => {
+const getRowValue = ({ column, row }: { column: PGColumn; row?: Dictionary<any> }) => {
const isNewRow = row === undefined
if (isNewRow) {
@@ -43,7 +43,7 @@ const getRowValue = ({ column, row }: { column: PostgresColumn; row?: Dictionary
export const generateRowFields = (
row: Dictionary<any> | undefined,
- table: PostgresTable,
+ table: PGTable,
foreignKeys: ForeignKey[]
): RowField[] => {
const { primary_keys = [] } = table
@@ -69,7 +69,7 @@ export const generateRowFields = (
target_table_name: foreignKey.table,
target_column_name:
foreignKey.columns.find((c) => c.source === column.name)?.target ?? '',
- } as PostgresRelationship)
+ } as PGTableRelationship)
: undefined,
id: column.id,
name: column.name,
diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.tsx b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.tsx
index 1256ed68c9f..a28b9161cf3 100644
--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.tsx
+++ b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.tsx
@@ -1,5 +1,5 @@
import * as Sentry from '@sentry/nextjs'
-import type { PostgresColumn, PostgresTable } from '@supabase/postgres-meta'
+import type { PGColumn, PGTable } from '@supabase/pg-meta'
import { useQueryClient } from '@tanstack/react-query'
import { useParams } from 'common'
import { isEmpty, isUndefined, noop } from 'lodash'
@@ -140,7 +140,7 @@ const createTableApiAccessHandlerParams = ({
selectedTable,
}: {
snap: DeepReadonly<TableEditorState>
- selectedTable?: PostgresTable
+ selectedTable?: PGTable
}): TableApiAccessParams | undefined => {
const tableSidePanel = snap.sidePanel?.type === 'table' ? snap.sidePanel : undefined
if (!tableSidePanel) return undefined
@@ -170,7 +170,7 @@ const createTableApiAccessHandlerParams = ({
export interface SidePanelEditorProps {
editable?: boolean
- selectedTable?: PostgresTable
+ selectedTable?: PGTable
includeColumns?: boolean // This is mainly used for invalidating useTablesQuery
// Because the panel is shared between grid editor and database pages
@@ -396,7 +396,7 @@ export const SidePanelEditor = ({
: await updateColumn({
projectRef: project?.ref!,
connectionString: project?.connectionString,
- originalColumn: selectedColumnToEdit as PostgresColumn,
+ originalColumn: selectedColumnToEdit as PGColumn,
payload: payload as UpdateColumnPayload,
selectedTable,
primaryKey,
@@ -924,7 +924,7 @@ export const SidePanelEditor = ({
<ColumnEditor
column={
snap.sidePanel?.type === 'column'
- ? (snap.sidePanel.column as unknown as PostgresColumn)
+ ? (snap.sidePanel.column as unknown as PGColumn)
: undefined
}
selectedTable={selectedTable}
diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.types.ts b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.types.ts
index 4a103f29c52..3b1de59264d 100644
--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.types.ts
+++ b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.types.ts
@@ -1,4 +1,4 @@
-import type { PostgresRelationship } from '@supabase/postgres-meta'
+import type { PGTableRelationship } from '@supabase/pg-meta'
import { CreateColumnBody } from '@/data/database-columns/database-column-create-mutation'
import { UpdateColumnBody } from '@/data/database-columns/database-column-update-mutation'
@@ -36,7 +36,7 @@ export interface Field {
foreignKey?: { table: string; column: string }
}
-export interface ExtendedPostgresRelationship extends PostgresRelationship {
+export interface ExtendedPostgresRelationship extends PGTableRelationship {
deletion_action: string
update_action: string
}
diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.utils.tsx b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.utils.tsx
index 63407a653e7..f9f46bb5ec0 100644
--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.utils.tsx
+++ b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.utils.tsx
@@ -11,8 +11,8 @@ import pgMeta, {
getUpdateIdentitySequenceSQL,
type ForeignKey,
} from '@supabase/pg-meta'
+import type { PGTablePrimaryKey } from '@supabase/pg-meta'
import { Query } from '@supabase/pg-meta/src/query'
-import type { PostgresPrimaryKey } from '@supabase/postgres-meta'
import { chunk, find, isEmpty, isEqual } from 'lodash'
import Papa from 'papaparse'
import { toast } from 'sonner'
@@ -788,7 +788,7 @@ export const updateTable = async ({
const primaryKeyColumns = columns
.filter((column) => column.isPrimaryKey)
.map((column) => column.name)
- const existingPrimaryKeyColumns = table.primary_keys.map((pk: PostgresPrimaryKey) => pk.name)
+ const existingPrimaryKeyColumns = table.primary_keys.map((pk: PGTablePrimaryKey) => pk.name)
const isPrimaryKeyUpdated = !isEqual(primaryKeyColumns, existingPrimaryKeyColumns)
if (isPrimaryKeyUpdated) {
diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SpreadsheetImport/SpreadsheetImport.tsx b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SpreadsheetImport/SpreadsheetImport.tsx
index 3b2b1a9bb77..52209e481ac 100644
--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SpreadsheetImport/SpreadsheetImport.tsx
+++ b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SpreadsheetImport/SpreadsheetImport.tsx
@@ -1,4 +1,4 @@
-import type { PostgresTable } from '@supabase/postgres-meta'
+import type { PGTable } from '@supabase/pg-meta'
import { useParams } from 'common'
import { noop } from 'lodash'
import { useCallback, type ChangeEvent, type DragEvent } from 'react'
@@ -25,7 +25,7 @@ import { useSelectedOrganizationQuery } from '@/hooks/misc/useSelectedOrganizati
interface SpreadsheetImportProps {
visible: boolean
- selectedTable?: PostgresTable
+ selectedTable?: PGTable
saveContent: (prefillData: ImportContent) => void
closePanel: () => void
updateEditorDirty?: (value: boolean) => void
diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.tsx b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.tsx
index 8156091cdfb..ec99a679a7f 100644
--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.tsx
+++ b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.tsx
@@ -1,4 +1,4 @@
-import type { PostgresTable } from '@supabase/postgres-meta'
+import type { PGTable } from '@supabase/pg-meta'
import { isEmpty, noop } from 'lodash'
import { useContext, useEffect, useMemo, useState } from 'react'
import { toast } from 'sonner'
@@ -23,7 +23,7 @@ import type { ImportContent, TableField } from './TableEditor.types'
import {
formatImportedContentToColumnFields,
generateTableField,
- generateTableFieldFromPostgresTable,
+ generateTableFieldFromPGTable,
validateFields,
} from './TableEditor.utils'
import { DocsButton } from '@/components/ui/DocsButton'
@@ -53,7 +53,7 @@ type SaveTablePayloadFor<Action extends SaveTableParams['action']> =
SaveTableParamsFor<Action>['payload']
export interface TableEditorProps {
- table?: PostgresTable
+ table?: PGTable
isDuplicating: boolean
templateData?: Partial<TableField>
visible: boolean
@@ -281,7 +281,7 @@ export const TableEditor = ({
}
setFkRelations([])
} else {
- const tableFields = generateTableFieldFromPostgresTable(
+ const tableFields = generateTableFieldFromPGTable(
table,
foreignKeyMeta ?? [],
isDuplicating,
@@ -303,7 +303,7 @@ export const TableEditor = ({
useEffect(() => {
if (!isNewRecord) {
- const tableFields = generateTableFieldFromPostgresTable(
+ const tableFields = generateTableFieldFromPGTable(
table,
foreignKeyMeta ?? [],
isDuplicating,
diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.utils.ts b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.utils.ts
index 6cf50fb6275..15c2e23eb04 100644
--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.utils.ts
+++ b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/TableEditor/TableEditor.utils.ts
@@ -1,4 +1,4 @@
-import type { PostgresTable } from '@supabase/postgres-meta'
+import type { PGTable } from '@supabase/pg-meta'
import { some } from 'lodash'
import {
@@ -40,8 +40,8 @@ export const generateTableField = (): TableField => {
}
}
-export const generateTableFieldFromPostgresTable = (
- table: PostgresTable,
+export const generateTableFieldFromPGTable = (
+ table: PGTable,
foreignKeys: ForeignKeyConstraint[],
isDuplicating = false,
isRealtimeEnabled = false
diff --git a/apps/studio/components/layouts/SQLEditorLayout/SqlEditor.Commands.tsx b/apps/studio/components/layouts/SQLEditorLayout/SqlEditor.Commands.tsx
index bb1097c1538..c71d2364ca0 100644
--- a/apps/studio/components/layouts/SQLEditorLayout/SqlEditor.Commands.tsx
+++ b/apps/studio/components/layouts/SQLEditorLayout/SqlEditor.Commands.tsx
@@ -1,4 +1,4 @@
-import { type PostgresColumn } from '@supabase/postgres-meta'
+import type { PGColumn } from '@supabase/pg-meta'
import { PermissionAction } from '@supabase/shared-types/out/constants'
import { useParams } from 'common'
import { AlertTriangle, Code, Loader2, Table2 } from 'lucide-react'
@@ -350,7 +350,7 @@ function TableSelector() {
)
}
-function generateSelectStatement(table: TablesData[number] & { columns?: Array<PostgresColumn> }) {
+function generateSelectStatement(table: TablesData[number] & { columns?: Array<PGColumn> }) {
return `
select ${
!table.columns
diff --git a/apps/studio/data/database-triggers/database-trigger-update-transaction-mutation.ts b/apps/studio/data/database-triggers/database-trigger-update-transaction-mutation.ts
index 738fe4a3061..7970bfb5c47 100644
--- a/apps/studio/data/database-triggers/database-trigger-update-transaction-mutation.ts
+++ b/apps/studio/data/database-triggers/database-trigger-update-transaction-mutation.ts
@@ -1,6 +1,9 @@
-import { getDatabaseTriggerUpdateSQL, type SafeSqlFragment } from '@supabase/pg-meta'
-import { PGTrigger, PGTriggerCreate } from '@supabase/pg-meta/src/pg-meta-triggers'
-import { PostgresTrigger } from '@supabase/postgres-meta'
+import {
+ getDatabaseTriggerUpdateSQL,
+ type PGTrigger,
+ type PGTriggerCreate,
+ type SafeSqlFragment,
+} from '@supabase/pg-meta'
import { useMutation, useQueryClient } from '@tanstack/react-query'
import { toast } from 'sonner'
@@ -15,7 +18,7 @@ import type { ResponseError, UseCustomMutationOptions } from '@/types'
export type DatabaseTriggerUpdateVariables = {
projectRef: string
connectionString?: string | null
- originalTrigger: PostgresTrigger
+ originalTrigger: PGTrigger
updatedTrigger: Omit<PGTriggerCreate, 'events'> &
Pick<PGTrigger, 'enabled_mode'> & { events: Array<SafeSqlFragment> }
}
diff --git a/apps/studio/data/foreign-tables/foreign-tables-query.ts b/apps/studio/data/foreign-tables/foreign-tables-query.ts
index 81714ed5397..c5c67439792 100644
--- a/apps/studio/data/foreign-tables/foreign-tables-query.ts
+++ b/apps/studio/data/foreign-tables/foreign-tables-query.ts
@@ -1,5 +1,5 @@
import pgMeta from '@supabase/pg-meta'
-import { PostgresView } from '@supabase/postgres-meta'
+import type { PGForeignTable } from '@supabase/pg-meta'
import { useQuery } from '@tanstack/react-query'
import { foreignTableKeys } from './keys'
@@ -26,7 +26,7 @@ export async function getForeignTables(
signal
)
- return result as PostgresView[]
+ return result as PGForeignTable[]
}
export type ForeignTablesData = Awaited<ReturnType<typeof getForeignTables>>
diff --git a/apps/studio/data/materialized-views/materialized-views-query.ts b/apps/studio/data/materialized-views/materialized-views-query.ts
index a627b5d71b4..78407c7b284 100644
--- a/apps/studio/data/materialized-views/materialized-views-query.ts
+++ b/apps/studio/data/materialized-views/materialized-views-query.ts
@@ -1,5 +1,5 @@
+import type { PGMaterializedView } from '@supabase/pg-meta'
import { DEFAULT_PLATFORM_APPLICATION_NAME } from '@supabase/pg-meta/src/constants'
-import { PostgresMaterializedView } from '@supabase/postgres-meta'
import { useQuery } from '@tanstack/react-query'
import { materializedViewKeys } from './keys'
@@ -38,7 +38,7 @@ export async function getMaterializedViews(
})
if (error) handleError(error)
- return data as PostgresMaterializedView[]
+ return data as PGMaterializedView[]
}
export type MaterializedViewsData = Awaited<ReturnType<typeof getMaterializedViews>>
diff --git a/apps/studio/data/table-editor/table-editor-types.ts b/apps/studio/data/table-editor/table-editor-types.ts
index 7e2e54443b8..af5c4a49ef1 100644
--- a/apps/studio/data/table-editor/table-editor-types.ts
+++ b/apps/studio/data/table-editor/table-editor-types.ts
@@ -1,15 +1,15 @@
import type {
- PostgresColumn,
- PostgresMaterializedView,
- PostgresRelationship,
- PostgresTable,
- PostgresView,
-} from '@supabase/postgres-meta'
+ PGColumn,
+ PGMaterializedView,
+ PGTable,
+ PGTableRelationship,
+ PGView,
+} from '@supabase/pg-meta'
import { WRAPPER_HANDLERS } from '@/components/interfaces/Integrations/Wrappers/Wrappers.constants'
import { ENTITY_TYPE } from '@/data/entity-types/entity-type-constants'
-interface TableRelationship extends PostgresRelationship {
+interface TableRelationship extends PGTableRelationship {
deletion_action: 'a' | 'r' | 'c' | 'n' | 'd'
update_action: 'a' | 'r' | 'c' | 'n' | 'd'
}
@@ -21,28 +21,28 @@ interface TableUniqueIndex {
columns: string[]
}
-export interface Table extends PostgresTable {
+export interface Table extends PGTable {
entity_type: ENTITY_TYPE.TABLE
- columns: PostgresColumn[]
+ columns: PGColumn[]
relationships: TableRelationship[]
unique_indexes?: TableUniqueIndex[]
}
-export interface PartitionedTable extends PostgresTable {
+export interface PartitionedTable extends PGTable {
entity_type: ENTITY_TYPE.PARTITIONED_TABLE
- columns: PostgresColumn[]
+ columns: PGColumn[]
relationships: TableRelationship[]
unique_indexes?: TableUniqueIndex[]
}
-export interface View extends PostgresView {
+export interface View extends PGView {
entity_type: ENTITY_TYPE.VIEW
- columns: PostgresColumn[]
+ columns: PGColumn[]
}
-export interface MaterializedView extends PostgresMaterializedView {
+export interface MaterializedView extends PGMaterializedView {
entity_type: ENTITY_TYPE.MATERIALIZED_VIEW
- columns: PostgresColumn[]
+ columns: PGColumn[]
}
export interface ForeignTable {
@@ -54,7 +54,7 @@ export interface ForeignTable {
foreign_server_name: string
foreign_data_wrapper_name: string
foreign_data_wrapper_handler: string
- columns: PostgresColumn[]
+ columns: PGColumn[]
}
export type Entity = Table | PartitionedTable | View | MaterializedView | ForeignTable
@@ -100,7 +100,7 @@ export function isViewLike(entity?: Entity): entity is View | MaterializedView {
return isView(entity) || isMaterializedView(entity)
}
-export function postgresTableToEntity(table: PostgresTable): Entity | undefined {
+export function postgresTableToEntity(table: PGTable): Entity | undefined {
if (table.columns === undefined || table.relationships === undefined) {
console.error(
'Unable to convert PostgresTable to Entity type: columns and relationships must not be undefined.'
diff --git a/apps/studio/data/tables/tables-query.ts b/apps/studio/data/tables/tables-query.ts
index da7e556cc09..e1f778b4f30 100644
--- a/apps/studio/data/tables/tables-query.ts
+++ b/apps/studio/data/tables/tables-query.ts
@@ -1,5 +1,5 @@
+import type { PGTable } from '@supabase/pg-meta'
import { DEFAULT_PLATFORM_APPLICATION_NAME } from '@supabase/pg-meta/src/constants'
-import type { PostgresTable } from '@supabase/postgres-meta'
import { useQuery, useQueryClient } from '@tanstack/react-query'
import { sortBy } from 'lodash'
import { useCallback } from 'react'
@@ -16,7 +16,7 @@ export type TablesVariables = {
* Defaults to false
*/
includeColumns?: boolean
- sortByProperty?: keyof PostgresTable
+ sortByProperty?: keyof PGTable
}
export async function getTables(
@@ -61,10 +61,10 @@ export async function getTables(
// Sort the data if the sortByName option is true
if (Array.isArray(data) && sortByProperty) {
- return sortBy(data, (t) => t[sortByProperty]) as PostgresTable[]
+ return sortBy(data, (t) => t[sortByProperty]) as PGTable[]
}
- return data as PostgresTable[]
+ return data as PGTable[]
}
export type TablesData = Awaited<ReturnType<typeof getTables>>
diff --git a/apps/studio/data/views/views-query.ts b/apps/studio/data/views/views-query.ts
index 93e26a6254a..bc784d02453 100644
--- a/apps/studio/data/views/views-query.ts
+++ b/apps/studio/data/views/views-query.ts
@@ -1,5 +1,5 @@
+import type { PGView } from '@supabase/pg-meta'
import { DEFAULT_PLATFORM_APPLICATION_NAME } from '@supabase/pg-meta/src/constants'
-import { PostgresView } from '@supabase/postgres-meta'
import { useQuery } from '@tanstack/react-query'
import { viewKeys } from './keys'
@@ -37,7 +37,7 @@ export async function getViews(
})
if (error) handleError(error)
- return data as PostgresView[]
+ return data as PGView[]
}
export type ViewsData = Awaited<ReturnType<typeof getViews>>
diff --git a/apps/studio/package.json b/apps/studio/package.json
index 8838b848d7e..39b6703f675 100644
--- a/apps/studio/package.json
+++ b/apps/studio/package.json
@@ -151,7 +151,6 @@
"@graphql-typed-document-node/core": "^3.2.0",
"@radix-ui/react-use-escape-keydown": "^1.1.1",
"@smithy/property-provider": "^4.0.4",
- "@supabase/postgres-meta": "^0.64.4",
"@testing-library/dom": "^10.0.0",
"@testing-library/jest-dom": "^6.6.0",
"@testing-library/react": "^16.0.0",
diff --git a/apps/studio/pages/project/[ref]/auth/policies.tsx b/apps/studio/pages/project/[ref]/auth/policies.tsx
index 0dfeb58ef68..6cba64d7a91 100644
--- a/apps/studio/pages/project/[ref]/auth/policies.tsx
+++ b/apps/studio/pages/project/[ref]/auth/policies.tsx
@@ -1,5 +1,5 @@
import { ident, safeSql } from '@supabase/pg-meta'
-import type { PostgresTable } from '@supabase/postgres-meta'
+import type { PGTable } from '@supabase/pg-meta'
import { PermissionAction } from '@supabase/shared-types/out/constants'
import { LOCAL_STORAGE_KEYS, useParams } from 'common'
import { Search, X } from 'lucide-react'
@@ -66,11 +66,7 @@ import type { NextPageWithLayout } from '@/types'
*
* @returns list of table
*/
-const getTableFilterState = (
- tables: PostgresTable[],
- policies: Array<Policy>,
- searchString?: string
-) => {
+const getTableFilterState = (tables: PGTable[], policies: Array<Policy>, searchString?: string) => {
const sortedTables = tables.slice().sort((a, b) => a.name.localeCompare(b.name))
const visibleTableIds = new Set<number>()
diff --git a/apps/studio/pages/project/[ref]/database/tables/index.tsx b/apps/studio/pages/project/[ref]/database/tables/index.tsx
index ffc53651194..4618234c8f6 100644
--- a/apps/studio/pages/project/[ref]/database/tables/index.tsx
+++ b/apps/studio/pages/project/[ref]/database/tables/index.tsx
@@ -1,4 +1,4 @@
-import { PostgresTable } from '@supabase/postgres-meta'
+import type { PGTable } from '@supabase/pg-meta'
import { LOCAL_STORAGE_KEYS, useParams } from 'common'
import { useState } from 'react'
import { PageContainer } from 'ui-patterns/PageContainer'
@@ -71,7 +71,7 @@ const DatabaseTables: NextPageWithLayout = () => {
</TableEditorTableStateContextProvider>
)}
- <SidePanelEditor includeColumns selectedTable={selectedTableToEdit as PostgresTable} />
+ <SidePanelEditor includeColumns selectedTable={selectedTableToEdit as PGTable} />
</>
)
}
diff --git a/apps/studio/state/table-editor.tsx b/apps/studio/state/table-editor.tsx
index 181d2e87356..d6e178bb4d5 100644
--- a/apps/studio/state/table-editor.tsx
+++ b/apps/studio/state/table-editor.tsx
@@ -1,5 +1,5 @@
import * as Sentry from '@sentry/nextjs'
-import type { PostgresColumn } from '@supabase/postgres-meta'
+import type { PGColumn } from '@supabase/pg-meta'
import { useConstant } from 'common'
import { createContext, PropsWithChildren, useContext } from 'react'
import { proxy, useSnapshot } from 'valtio'
@@ -27,13 +27,13 @@ export const TABLE_EDITOR_DEFAULT_ROWS_PER_PAGE = 100
type ForeignKeyState = {
foreignKey: ForeignKey
row: Dictionary<any>
- column: PostgresColumn
+ column: PGColumn
}
export type SidePanel =
| { type: 'cell'; value?: { column: string; row: Dictionary<any> } }
| { type: 'row'; row?: Dictionary<any> }
- | { type: 'column'; column?: PostgresColumn }
+ | { type: 'column'; column?: PGColumn }
| { type: 'table'; mode: 'new' | 'edit' | 'duplicate'; templateData?: Partial<TableField> }
| { type: 'schema'; mode: 'new' | 'edit' }
| { type: 'json'; jsonValue: EditValue }
@@ -46,7 +46,7 @@ export type SidePanel =
export type ConfirmationDialog =
| { type: 'table'; isDeleteWithCascade: boolean }
- | { type: 'column'; column: PostgresColumn; isDeleteWithCascade: boolean }
+ | { type: 'column'; column: PGColumn; isDeleteWithCascade: boolean }
// [Joshen] Just FYI callback, numRows, allRowsSelected is a temp workaround so that
// DeleteConfirmationDialog can trigger dispatch methods after the successful deletion of rows.
// Once we deprecate react tracked and move things to valtio, we can remove this.
@@ -142,13 +142,13 @@ export const createTableEditorState = () => {
sidePanel: { type: 'column' },
}
},
- onEditColumn: (column: PostgresColumn) => {
+ onEditColumn: (column: PGColumn) => {
state.ui = {
open: 'side-panel',
sidePanel: { type: 'column', column },
}
},
- onDeleteColumn: (column: PostgresColumn) => {
+ onDeleteColumn: (column: PGColumn) => {
state.ui = {
open: 'confirmation-dialog',
confirmationDialog: { type: 'column', column, isDeleteWithCascade: false },
diff --git a/apps/studio/types/ui.ts b/apps/studio/types/ui.ts
index 27b21d9a9b8..e32a8831f10 100644
--- a/apps/studio/types/ui.ts
+++ b/apps/studio/types/ui.ts
@@ -1,4 +1,4 @@
-import type { PostgresColumn } from '@supabase/postgres-meta'
+import type { PGColumn } from '@supabase/pg-meta'
import { ProjectLogStatsVariables } from '@/data/analytics/project-log-stats-query'
@@ -41,5 +41,5 @@ export interface SchemaView {
schema: string
is_updatable: boolean
comment?: string
- columns: PostgresColumn[]
+ columns: PGColumn[]
}
diff --git a/packages/pg-meta/src/index.ts b/packages/pg-meta/src/index.ts
index f06fbe0c331..98ea5cbbc9f 100644
--- a/packages/pg-meta/src/index.ts
+++ b/packages/pg-meta/src/index.ts
@@ -45,6 +45,16 @@ export {
} from './pg-format'
export type { SafeSqlFragment, UntrustedSqlFragment, DisplayableSqlFragment } from './pg-format'
+export type { PGTable, PGTablePrimaryKey, PGTableRelationship } from './pg-meta-tables'
+export type { PGColumn } from './pg-meta-columns'
+export type { PGPolicy } from './pg-meta-policies'
+export type { PGTrigger, PGTriggerCreate, PGTriggerUpdate } from './pg-meta-triggers'
+export type { PGView } from './pg-meta-views'
+export type { PGMaterializedView } from './pg-meta-materialized-views'
+export type { PGForeignTable } from './pg-meta-foreign-tables'
+export type { PGSchema } from './pg-meta-schemas'
+export type { PGPublication } from './pg-meta-publications'
+
export default {
roles,
columns,
diff --git a/packages/pg-meta/src/pg-meta-schemas.ts b/packages/pg-meta/src/pg-meta-schemas.ts
index 3ff8ba8d487..0005f8cf706 100644
--- a/packages/pg-meta/src/pg-meta-schemas.ts
+++ b/packages/pg-meta/src/pg-meta-schemas.ts
@@ -13,6 +13,8 @@ const pgSchemaZod = z.object({
const pgSchemaArrayZod = z.array(pgSchemaZod)
const pgSchemaOptionalZod = z.optional(pgSchemaZod)
+export type PGSchema = z.infer<typeof pgSchemaZod>
+
function list({
includeSystemSchemas = false,
limit,
diff --git a/packages/pg-meta/src/pg-meta-tables.ts b/packages/pg-meta/src/pg-meta-tables.ts
index 407003ee0d8..c2305894324 100644
--- a/packages/pg-meta/src/pg-meta-tables.ts
+++ b/packages/pg-meta/src/pg-meta-tables.ts
@@ -52,6 +52,8 @@ const pgTableZod = z.object({
const pgTableArrayZod = z.array(pgTableZod)
export type PGTable = z.infer<typeof pgTableZod>
+export type PGTablePrimaryKey = z.infer<typeof pgTablePrimaryKeyZod>
+export type PGTableRelationship = z.infer<typeof pgTableRelationshipZod>
type TableWithoutColumns = Omit<PGTable, 'columns'>
type TableWithColumns = PGTable
diff --git a/packages/pg-meta/src/pg-meta-triggers.ts b/packages/pg-meta/src/pg-meta-triggers.ts
index f2a10184334..7bc999be875 100644
--- a/packages/pg-meta/src/pg-meta-triggers.ts
+++ b/packages/pg-meta/src/pg-meta-triggers.ts
@@ -26,8 +26,8 @@ export const pgTriggerZod = z.object({
table: z.string(),
schema: z.string(),
condition: z.string().nullable(),
- orientation: z.string(),
- activation: z.string(),
+ orientation: z.enum(['ROW', 'STATEMENT']),
+ activation: z.enum(['BEFORE', 'AFTER', 'INSTEAD OF']),
events: z.array(z.string()),
function_name: z.string(),
function_schema: z.string(),
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 0bfbabe208b..2169a64ce57 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -1209,9 +1209,6 @@ importers:
'@smithy/property-provider':
specifier: ^4.0.4
version: 4.0.4
- '@supabase/postgres-meta':
- specifier: ^0.64.4
'@testing-library/dom':
specifier: ^10.0.0
version: 10.4.1
@@ -7396,9 +7393,6 @@ packages:
'@simple-git/[email protected]':
resolution: {integrity: sha512-Q9lBcfQ+VQCpQqGJFHe5yooOS5hGdLFFbJ5R+R5aDsnkPCahtn1hSkMcORX65J2Z5lxSkD0lQorMsncuBQxYUw==}
- '@sinclair/[email protected]':
- resolution: {integrity: sha512-XJfwUVUKDHF5ugKwIcxEgc9k8b7HbznCp6eUfWgu710hMPNIO4aw4/zB5RogDQz8nd6gyCDpU9O/m6qYEWY6yQ==}
-
'@sindresorhus/[email protected]':
resolution: {integrity: sha512-7F/yz2IphV39hiS2zB4QYVkivrptHHh0K8qJJd9HhuWSdvf8AN7NpebW3CcDZDBQsUPMoDKWsY2WWgW7bqOcfA==}
engines: {node: '>=18'}
@@ -7645,10 +7639,6 @@ packages:
'@supabase/[email protected]':
resolution: {integrity: sha512-YSAGnmDAfuleFCVt3CeurQZAhxRfXWeZIIkwp7NhYzQ1UwW6ePSnzsFAiUm/mbCkfoCf70QQHKW/K6RKh52a4A==}
- '@supabase/[email protected]':
- resolution: {integrity: sha512-vz5gc6RKNfDVnIfRUmH2ssTMYFI0U3MYOVyQ9R4YkzOS2dKSanjC4rTEDGjlMFwGTCUPW3N3pbY7HJIW81wMyg==}
- engines: {node: '>=16', npm: '>=8'}
-
'@supabase/[email protected]':
resolution: {integrity: sha512-SppIyLo/kTwIlz1qpv2HN1EQqBg0GVktrDDFsXygYROha3MgVn4rT7p5EjFHFqXQm2rdRGb/BI7bc+jr10m91w==}
engines: {node: '>=20.0.0'}
@@ -9335,10 +9325,6 @@ packages:
resolution: {integrity: sha512-RKshQI1R3YQ+n9YJz2QQ147P66ELpa1FQEg20Dk8oW9t2KgLbpDLLp9aGZ7y8WHSshDknG0bknqGw5/tyCs5tw==}
- resolution: {integrity: sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==}
- engines: {node: '>=0.6'}
-
resolution: {integrity: sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==}
@@ -10561,9 +10547,6 @@ packages:
resolution: {integrity: sha512-nI4U3TottKAcAD9LLud4Cb7b2QztQMUEfHbvhTH09bqXTxnSie8WnjPALV/WMCrJZ6UV/qHJ6L03OqO3LcdYZw==}
engines: {node: '>=12'}
- resolution: {integrity: sha512-V0EWmKeH3DEhMwAZ+8ZB2Ao4OK6p++Z0hsDtZq3N0+0ZMVqkzrcEGROvOnZpLnvBg5PTNG23JEDLAm64gPaotQ==}
-
resolution: {integrity: sha512-pYxfDYpued//QpnLIm4Avk7rsNtAtQkUES2cwAYSvD/wd2pKD71gN2Ebj3e7klzXwjocvE8c5vx/1fxwpqmSxA==}
engines: {node: '>=4'}
@@ -13978,10 +13961,6 @@ packages:
resolution: {integrity: sha512-TdC8FSgHz8Mwtw9g5L4gR/Sh9XhSP/0DEkQxfEFXOpiul5IiHgHan2VhYYb6agDSfp4KuvltmGApc8HMgUrIkA==}
- resolution: {integrity: sha512-2YEOR5qlI1zUFbGMLKNfsrR5JUvFg9LxIRVE+xJe962pfVLH0rnItqLzv96XVs1Y1UIR8FxsXAuvX/lYAWZ2BQ==}
- engines: {node: '>=8'}
-
resolution: {integrity: sha512-TMB1uHiGsHRGv1uYclfhivcnf0/PdFp2pNqRxXjncaAsjYMoisaQJI+SSZCqRq+VliwRTC8tsMQfmrWjDMhkPQ==}
engines: {node: '>=20'}
@@ -14531,10 +14510,6 @@ packages:
resolution: {integrity: sha512-nkc6NpDcvPVpZXxrreI/FOtX3XemeLl8E0qFr6F2Lrm/I8WOnaWNhIPK2Z7OHpw7gh5XJThi6j6ppgNoaT1w4w==}
- resolution: {integrity: sha512-YyKEF78pEA6wwTAqOUaHIN/rWpfzzIuMh9KdAhc3rSLQ/7zkRFcCgYBAEGatDstLyZw4g0s9SNICmaTGnBVeyw==}
- engines: {node: '>=4.0'}
-
resolution: {integrity: sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==}
engines: {node: '>=4.0.0'}
@@ -14578,16 +14553,6 @@ packages:
resolution: {integrity: sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==}
- resolution: {integrity: sha512-mVECYO+utvPuw+PWXmPeIkQqVTERreRXVPW1rVmCS4XzXV3hpor9jKhcRbfvmGkGqSHs6KsRdDmYj9QdpdOMng==}
-
- resolution: {integrity: sha512-h3OSGbv1rB1r3lWL3l0gHIMVMVBTzEzROkP2/Wpz2s1eDAffPf9O5x0OqrRdLzhze92S9GUqO/FrS15u027xyg==}
-
- resolution: {integrity: sha512-5eWkisSQo66x9F5m+RvDz12IRtKnAoEEGz3bygwCppQl+0EZ0yrNOB6hhZZHcxoZxJ1psNdobwoQMe7SzaZFWg==}
- hasBin: true
-
resolution: {integrity: sha512-7h9/fjPD3qNlgggzm88cY58l9sudZ6Ey+UmZsizfhtawO6E3srZQXywaNm2lBwT72TbpHYRPy7ytIHeBUD/G0A==}
@@ -14885,17 +14850,6 @@ packages:
resolution: {integrity: sha512-IEbKtlZ+H94uWFHQt4iKWMiJJRIuzWYw8jeLz+RCzy4bDtsM3/07GIF1+EFCbT9d0gWibTPotZWx8o3hz+ITeA==}
- resolution: {integrity: sha512-Ui9603tDD6PFyr7JvIEoE6cIFMQnJVDriG+oLyVThsGo/MIl5ek18JhH3xtox9ux8jvyww/FUFrJzxpZ7FIdvw==}
- engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0}
- peerDependencies:
- prettier: ^2.0.0
-
- resolution: {integrity: sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==}
- engines: {node: '>=10.13.0'}
- hasBin: true
-
resolution: {integrity: sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg==}
engines: {node: '>=14'}
@@ -16091,10 +16045,6 @@ packages:
resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==}
- resolution: {integrity: sha512-6QumAdGHEnI5dXEq1d0aBRP876AyA9Wp/UE7wopKNA2Mp9sKGRKVqGgoWHk4dr0J0nceesC85Y0p36qmGoNqhw==}
- hasBin: true
-
resolution: {integrity: sha512-5vmt2HlCAVozxsBZuXWkAki/KGawaK+b5GG5x+BtXOFVpN/8cqppblFUxHl4jxdA0cvo14lABhM+KBnrUapOlw==}
hasBin: true
@@ -23539,8 +23489,6 @@ snapshots:
dependencies:
'@simple-git/args-pathspec': 1.0.3
- '@sinclair/[email protected]': {}
-
'@sindresorhus/[email protected]': {}
'@sindresorhus/[email protected]': {}
@@ -23889,20 +23837,6 @@ snapshots:
'@supabase/[email protected]': {}
- dependencies:
- '@sinclair/typebox': 0.25.24
- pg: 8.16.3
- pg-format: 1.0.4
- pgsql-parser: 13.5.0([email protected])([email protected])
- postgres-array: 3.0.2
- prettier: 2.8.8
- prettier-plugin-sql: 0.13.0([email protected])
- transitivePeerDependencies:
- - encoding
- - pg-native
- - supports-color
-
'@supabase/[email protected]':
dependencies:
tslib: 2.8.1
@@ -25835,8 +25769,6 @@ snapshots:
dependencies:
require-from-string: 2.0.2
-
@@ -27178,8 +27110,6 @@ snapshots:
-
@@ -31585,10 +31515,6 @@ snapshots:
- dependencies:
- big-integer: 1.6.51
-
@@ -32336,8 +32262,6 @@ snapshots:
-
@@ -32384,27 +32308,6 @@ snapshots:
dependencies:
split2: 4.2.0
- dependencies:
- '@babel/runtime': 7.26.10
- dotty: 0.1.2
- pgsql-enums: 13.1.3
-
- dependencies:
- '@babel/runtime': 7.26.10
-
- dependencies:
- '@babel/runtime': 7.26.10
- libpg-query: 15.2.0([email protected])([email protected])
- minimist: 1.2.8
- pgsql-deparser: 13.4.0
- pgsql-enums: 13.1.3
- transitivePeerDependencies:
- - encoding
- - supports-color
-
@@ -32678,15 +32581,6 @@ snapshots:
prettier: 3.8.1
sql-parser-cst: 0.38.2
- dependencies:
- node-sql-parser: 4.18.0
- prettier: 2.8.8
- sql-formatter: 11.0.2
- tslib: 2.8.1
-
-
@@ -34309,11 +34203,6 @@ snapshots:
- dependencies:
- argparse: 2.0.1
- nearley: 2.20.1
-
dependencies:
argparse: 2.0.1