mirror of
https://github.com/supabase/supabase.git
synced 2026-10-08 19:05:06 +03:00
Merge branch 'master' into fix-auth-dashboard
This commit is contained in:
8 files changed
+73
-13
No files matched your search
@@ -108,7 +108,7 @@ const NewOrgForm = ({ onPaymentMethodReset }: NewOrgFormProps) => {
|
||||
payment_method: paymentMethodId,
|
||||
V2: true,
|
||||
})
|
||||
} finally {
|
||||
} catch (error) {
|
||||
setNewOrgLoading(false)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1230,6 +1230,48 @@ begin
|
||||
limit match_count;
|
||||
end;
|
||||
$$;
|
||||
`.trim(),
|
||||
},
|
||||
{
|
||||
id: 24,
|
||||
type: 'template',
|
||||
title: 'dbdev',
|
||||
description: 'dbdev is a client for installing 3rd party packages into your database.',
|
||||
sql: `
|
||||
create extension if not exists http with schema extensions;
|
||||
create extension if not exists pg_tle;
|
||||
select pgtle.uninstall_extension_if_exists('supabase-dbdev');
|
||||
drop extension if exists "supabase-dbdev";
|
||||
select
|
||||
pgtle.install_extension(
|
||||
'supabase-dbdev',
|
||||
resp.contents ->> 'version',
|
||||
'PostgreSQL package manager',
|
||||
resp.contents ->> 'sql'
|
||||
)
|
||||
from http(
|
||||
(
|
||||
'GET',
|
||||
'https://api.database.dev/rest/v1/'
|
||||
|| 'package_versions?select=sql,version'
|
||||
|| '&package_name=eq.supabase-dbdev'
|
||||
|| '&order=version.desc'
|
||||
|| '&limit=1',
|
||||
array[
|
||||
('apiKey', 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InhtdXB0cHBsZnZpaWZyYndtbXR2Iiwicm9sZSI6ImFub24iLCJpYXQiOjE2ODAxMDczNzIsImV4cCI6MTk5NTY4MzM3Mn0.z2CN0mvO2No8wSi46Gw59DFGCTJrzM0AQKsu_5k134s')::http_header
|
||||
],
|
||||
null,
|
||||
null
|
||||
)
|
||||
) x,
|
||||
lateral (
|
||||
select
|
||||
((row_to_json(x) -> 'content') #>> '{}')::json -> 0
|
||||
) resp(contents);
|
||||
create extension "supabase-dbdev";
|
||||
select dbdev.install('supabase-dbdev');
|
||||
drop extension if exists "supabase-dbdev";
|
||||
create extension "supabase-dbdev";
|
||||
`.trim(),
|
||||
},
|
||||
]
|
||||
|
||||
@@ -3,7 +3,7 @@ import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectConte
|
||||
import { useStore } from 'hooks'
|
||||
import { copyToClipboard } from 'lib/helpers'
|
||||
import Telemetry from 'lib/telemetry'
|
||||
import { compact, isString, map } from 'lodash'
|
||||
import { compact, isObject, isString, map } from 'lodash'
|
||||
import { useRouter } from 'next/router'
|
||||
import { useMemo, useRef } from 'react'
|
||||
import { CSVLink } from 'react-csv'
|
||||
@@ -34,6 +34,10 @@ const ResultsDropdown = ({ id }: ResultsDropdownProps) => {
|
||||
// escape all quotation marks
|
||||
return v.replaceAll(/\n/g, '\\n').replaceAll(/"/g, '""')
|
||||
}
|
||||
if (isObject(v)) {
|
||||
// replace all quotation marks with two quotation marks to escape them.
|
||||
return JSON.stringify(v).replaceAll(/\"/g, '""')
|
||||
}
|
||||
return v
|
||||
})
|
||||
})
|
||||
|
||||
@@ -218,9 +218,10 @@ export const CREATE_PG_GET_TABLEDEF_SQL = minify(
|
||||
END IF;
|
||||
IF bPartition THEN
|
||||
--v17 fix for case-sensitive tables
|
||||
-- SELECT count(*) INTO v_cnt FROM information_schema.tables t WHERE EXISTS (SELECT REGEXP_MATCHES(s.table_name, '([A-Z]+)','g') FROM information_schema.tables s
|
||||
-- WHERE t.table_schema=s.table_schema AND t.table_name=s.table_name AND t.table_schema = quote_ident(in_schema) AND t.table_name = quote_ident(in_table) AND t.table_type = 'BASE TABLE');
|
||||
SELECT count(*) INTO v_cnt FROM information_schema.tables t WHERE EXISTS (SELECT REGEXP_MATCHES(s.table_name, '([A-Z]+)','g') FROM information_schema.tables s
|
||||
WHERE t.table_schema=s.table_schema AND t.table_name=s.table_name AND t.table_schema = quote_ident(in_schema) AND t.table_type = 'BASE TABLE');
|
||||
|
||||
WHERE t.table_schema=s.table_schema AND t.table_name=s.table_name AND t.table_schema = in_schema AND t.table_name = in_table AND t.table_type = 'BASE TABLE');
|
||||
IF bInheritance THEN
|
||||
-- inheritance-based
|
||||
IF v_cnt > 0 THEN
|
||||
@@ -265,8 +266,10 @@ export const CREATE_PG_GET_TABLEDEF_SQL = minify(
|
||||
-- start the create definition for regular tables unless we are in progress creating an inheritance-based child table
|
||||
IF NOT bPartition THEN
|
||||
--v17 fix for case-sensitive tables
|
||||
-- SELECT count(*) INTO v_cnt FROM information_schema.tables t WHERE EXISTS (SELECT REGEXP_MATCHES(s.table_name, '([A-Z]+)','g') FROM information_schema.tables s
|
||||
-- WHERE t.table_schema=s.table_schema AND t.table_name=s.table_name AND t.table_schema = quote_ident(in_schema) AND t.table_name = quote_ident(in_table) AND t.table_type = 'BASE TABLE');
|
||||
SELECT count(*) INTO v_cnt FROM information_schema.tables t WHERE EXISTS (SELECT REGEXP_MATCHES(s.table_name, '([A-Z]+)','g') FROM information_schema.tables s
|
||||
WHERE t.table_schema=s.table_schema AND t.table_name=s.table_name AND t.table_schema = quote_ident(in_schema) AND t.table_type = 'BASE TABLE');
|
||||
WHERE t.table_schema=s.table_schema AND t.table_name=s.table_name AND t.table_schema = in_schema AND t.table_name = in_table AND t.table_type = 'BASE TABLE');
|
||||
IF v_cnt > 0 THEN
|
||||
v_table_ddl := 'CREATE ' || v_temp || ' TABLE ' || in_schema || '."' || in_table || '" (' || E'\\n';
|
||||
ELSE
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react
|
||||
import { toast } from 'react-hot-toast'
|
||||
|
||||
import { post } from 'data/fetchers'
|
||||
import { permissionKeys } from 'data/permissions/keys'
|
||||
import { ResponseError } from 'types'
|
||||
import { organizationKeys } from './keys'
|
||||
|
||||
@@ -54,7 +55,10 @@ export const useOrganizationCreateMutation = ({
|
||||
(vars) => createOrganization(vars),
|
||||
{
|
||||
async onSuccess(data, variables, context) {
|
||||
await queryClient.invalidateQueries(organizationKeys.list())
|
||||
await Promise.all([
|
||||
queryClient.invalidateQueries(organizationKeys.list()),
|
||||
queryClient.invalidateQueries(permissionKeys.list()),
|
||||
])
|
||||
await onSuccess?.(data, variables, context)
|
||||
},
|
||||
async onError(data, variables, context) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import { toast } from 'react-hot-toast'
|
||||
import { del } from 'data/fetchers'
|
||||
import { ResponseError } from 'types'
|
||||
import { organizationKeys } from './keys'
|
||||
import { permissionKeys } from 'data/permissions/keys'
|
||||
|
||||
export type OrganizationDeleteVariables = {
|
||||
slug: string
|
||||
@@ -33,7 +34,10 @@ export const useOrganizationDeleteMutation = ({
|
||||
(vars) => deleteOrganization(vars),
|
||||
{
|
||||
async onSuccess(data, variables, context) {
|
||||
await queryClient.invalidateQueries(organizationKeys.list())
|
||||
await Promise.all([
|
||||
queryClient.invalidateQueries(organizationKeys.list()),
|
||||
queryClient.invalidateQueries(permissionKeys.list()),
|
||||
])
|
||||
await onSuccess?.(data, variables, context)
|
||||
},
|
||||
async onError(data, variables, context) {
|
||||
|
||||
@@ -9,7 +9,7 @@ import { useCallback, useEffect, useState } from 'react'
|
||||
import { NewOrgForm } from 'components/interfaces/Organization'
|
||||
import { WizardLayout } from 'components/layouts'
|
||||
import { useSetupIntent } from 'data/stripe/setup-intent-mutation'
|
||||
import { useFlag, useStore } from 'hooks'
|
||||
import { useFlag } from 'hooks'
|
||||
import { STRIPE_PUBLIC_KEY } from 'lib/constants'
|
||||
import { useIsHCaptchaLoaded } from 'stores/hcaptcha-loaded-store'
|
||||
import { NextPageWithLayout } from 'types'
|
||||
@@ -20,7 +20,6 @@ const stripePromise = loadStripe(STRIPE_PUBLIC_KEY)
|
||||
* No org selected yet, create a new one
|
||||
*/
|
||||
const Wizard: NextPageWithLayout = () => {
|
||||
const { ui } = useStore()
|
||||
const router = useRouter()
|
||||
const { isDarkMode } = useTheme()
|
||||
|
||||
|
||||
@@ -94,7 +94,11 @@ const Wizard: NextPageWithLayout = () => {
|
||||
enabled: currentOrg?.subscription_id != undefined,
|
||||
})
|
||||
|
||||
const { mutate: createProject, isLoading: isCreatingNewProject } = useProjectCreateMutation({
|
||||
const {
|
||||
mutate: createProject,
|
||||
isLoading: isCreatingNewProject,
|
||||
isSuccess: isSuccessNewProject,
|
||||
} = useProjectCreateMutation({
|
||||
onSuccess: (res) => {
|
||||
router.push(`/project/${res.ref}/building`)
|
||||
},
|
||||
@@ -260,7 +264,7 @@ const Wizard: NextPageWithLayout = () => {
|
||||
<div key="panel-footer" className="flex items-center justify-between w-full">
|
||||
<Button
|
||||
type="default"
|
||||
disabled={isCreatingNewProject}
|
||||
disabled={isCreatingNewProject || isSuccessNewProject}
|
||||
onClick={() => router.push('/projects')}
|
||||
>
|
||||
Cancel
|
||||
@@ -271,8 +275,8 @@ const Wizard: NextPageWithLayout = () => {
|
||||
)}
|
||||
<Button
|
||||
onClick={onClickNext}
|
||||
loading={isCreatingNewProject}
|
||||
disabled={isCreatingNewProject || !canSubmit}
|
||||
loading={isCreatingNewProject || isSuccessNewProject}
|
||||
disabled={isCreatingNewProject || isSuccessNewProject || !canSubmit}
|
||||
>
|
||||
Create new project
|
||||
</Button>
|
||||
|
||||
Reference in new issue
Block a user