mirror of
https://github.com/supabase/supabase.git
synced 2026-10-16 06:39:09 +03:00
Load foreign keys properly
This commit is contained in:
1 parent
f003ec8df1
commit
2eb341dcfe
1 file changed
+15
-5
+15
-5
@@ -130,11 +130,21 @@ const TableEditor = ({
|
||||
(constraint) => constraint.type === CONSTRAINT_TYPE.PRIMARY_KEY_CONSTRAINT
|
||||
)
|
||||
|
||||
const { data: foreignKeyMeta } = useForeignKeyConstraintsQuery({
|
||||
projectRef: project?.ref,
|
||||
connectionString: project?.connectionString,
|
||||
schema: table?.schema,
|
||||
})
|
||||
const { data: foreignKeyMeta } = useForeignKeyConstraintsQuery(
|
||||
{
|
||||
projectRef: project?.ref,
|
||||
connectionString: project?.connectionString,
|
||||
schema: table?.schema,
|
||||
},
|
||||
{
|
||||
onSuccess: (data) => {
|
||||
const relevantForeignKeys = data.filter(
|
||||
(fk) => fk.source_schema === table?.schema && fk.source_table === table?.name
|
||||
)
|
||||
setFkRelations(formatForeignKeys(relevantForeignKeys))
|
||||
},
|
||||
}
|
||||
)
|
||||
const foreignKeys = (foreignKeyMeta ?? []).filter(
|
||||
(fk) => fk.source_schema === table?.schema && fk.source_table === table?.name
|
||||
)
|
||||
|
||||
Reference in new issue
Block a user