mirror of
https://github.com/supabase/supabase.git
synced 2026-10-15 06:09:08 +03:00
fix(studio): uniformize readDatabase and projectDetails connString handling
This commit is contained in:
1 parent
93d8567695
commit
8726ac65e9
2 files changed
+9
-4
No files matched your search
@@ -147,9 +147,12 @@ export const SQLEditor = () => {
|
||||
const { data: subscription } = useOrgSubscriptionQuery({ orgSlug: org?.slug })
|
||||
const hasHipaaAddon = subscriptionHasHipaaAddon(subscription)
|
||||
|
||||
const { data: databases, isSuccess: isSuccessReadReplicas } = useReadReplicasQuery({
|
||||
projectRef: ref,
|
||||
})
|
||||
const { data: databases, isSuccess: isSuccessReadReplicas } = useReadReplicasQuery(
|
||||
{
|
||||
projectRef: ref,
|
||||
},
|
||||
{ enabled: Boolean(project?.connectionString) }
|
||||
)
|
||||
|
||||
const { data, refetch: refetchEntityDefinitions } = useEntityDefinitionsQuery(
|
||||
{
|
||||
@@ -157,7 +160,7 @@ export const SQLEditor = () => {
|
||||
projectRef: project?.ref,
|
||||
connectionString: project?.connectionString,
|
||||
},
|
||||
{ enabled: includeSchemaMetadata }
|
||||
{ enabled: Boolean(project?.connectionString) && includeSchemaMetadata }
|
||||
)
|
||||
const entityDefinitions = includeSchemaMetadata ? data?.map((def) => def.sql.trim()) : undefined
|
||||
|
||||
@@ -308,6 +311,7 @@ export const SQLEditor = () => {
|
||||
const connectionString = databases?.find(
|
||||
(db) => db.identifier === databaseSelectorState.selectedDatabaseId
|
||||
)?.connectionString
|
||||
// TODO: in which case if it's not "IS_PLATFORM" it would work ?
|
||||
if (IS_PLATFORM && !connectionString) {
|
||||
return toast.error('Unable to run query: Connection string is missing')
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ export async function executeSql(
|
||||
headersInit?: HeadersInit
|
||||
): Promise<{ result: any }> {
|
||||
if (!projectRef) throw new Error('projectRef is required')
|
||||
if (!connectionString) throw new Error('Project connection string is required')
|
||||
|
||||
const sqlSize = new Blob([sql]).size
|
||||
// [Joshen] I think the limit is around 1MB from testing, but its not exactly 1MB it seems
|
||||
|
||||
Reference in new issue
Block a user