The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat: Add support for `import foreign schema` for wrappers (#36827)
Ivan Vasilova88e89e4a86b
diff --git a/apps/studio/components/interfaces/Integrations/Wrappers/CreateWrapperSheet.tsx b/apps/studio/components/interfaces/Integrations/Wrappers/CreateWrapperSheet.tsxindex 376b7999c8f..e2957799175 100644--- a/apps/studio/components/interfaces/Integrations/Wrappers/CreateWrapperSheet.tsx+++ b/apps/studio/components/interfaces/Integrations/Wrappers/CreateWrapperSheet.tsx@@ -4,11 +4,26 @@ import { Edit, Trash } from 'lucide-react'import { useState } from 'react'import { toast } from 'sonner'+import SchemaEditor from 'components/interfaces/TableGridEditor/SidePanelEditor/SchemaEditor'import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'import { FormSection, FormSectionContent, FormSectionLabel } from 'components/ui/Forms/FormSection'-import { invalidateSchemasQuery } from 'data/database/schemas-query'+import SchemaSelector from 'components/ui/SchemaSelector'+import { useDatabaseExtensionsQuery } from 'data/database-extensions/database-extensions-query'+import { invalidateSchemasQuery, useSchemasQuery } from 'data/database/schemas-query'import { useFDWCreateMutation } from 'data/fdw/fdw-create-mutation'-import { Button, Form, Input, SheetFooter, SheetHeader, SheetTitle } from 'ui'+import {+ Button,+ Form,+ Input,+ Label_Shadcn_,+ RadioGroupStacked,+ RadioGroupStackedItem,+ Separator,+ SheetFooter,+ SheetHeader,+ SheetTitle,+ WarningIcon,+} from 'ui'import ConfirmationModal from 'ui-patterns/Dialogs/ConfirmationModal'import InputField from './InputField'import { WrapperMeta } from './Wrappers.types'@@ -35,7 +50,23 @@ export const CreateWrapperSheet = ({const [newTables, setNewTables] = useState<any[]>([])const [isEditingTable, setIsEditingTable] = useState(false)+ const [createSchemaSheetOpen, setCreateSchemaSheetOpen] = useState(false)const [selectedTableToEdit, setSelectedTableToEdit] = useState()+ const [selectedMode, setSelectedMode] = useState<'tables' | 'schema'>(+ wrapperMeta.tables.length > 0 ? 'tables' : 'schema'+ )++ const { data: extensions } = useDatabaseExtensionsQuery({+ projectRef: project?.ref,+ connectionString: project?.connectionString,+ })++ const wrappersExtension = extensions?.find((ext) => ext.name === 'wrappers')+ // The import foreign schema requires a minimum extension version of 0.5.0+ const hasRequiredVersionForeignSchema = wrappersExtension?.installed_version+ ? wrappersExtension?.installed_version >= '0.5.0'+ : false+const [formErrors, setFormErrors] = useState<{ [k: string]: string }>({})const { mutate: createFDW, isLoading: isCreating } = useFDWCreateMutation({@@ -50,9 +81,14 @@ export const CreateWrapperSheet = ({},})+ // prefetch schemas to make sure the schema selector is populated+ useSchemasQuery({ projectRef: project?.ref, connectionString: project?.connectionString })+const initialValues = {wrapper_name: '',server_name: '',+ source_schema: wrapperMeta.sourceSchemaOption?.defaultValue ?? '',+ target_schema: 'public',...Object.fromEntries(wrapperMeta.server.options.map((option) => [option.name, option.defaultValue ?? ''])),@@ -80,7 +116,9 @@ export const CreateWrapperSheet = ({const { wrapper_name } = valuesif (wrapper_name.length === 0) errors.name = 'Please provide a name for your wrapper'- if (newTables.length === 0) errors.tables = 'Please add at least one table'+ if (selectedMode === 'tables' && newTables.length === 0) {+ errors.tables = 'Please add at least one table'+ }if (!isEmpty(errors)) return setFormErrors(errors)createFDW({@@ -88,7 +126,10 @@ export const CreateWrapperSheet = ({connectionString: project?.connectionString,wrapperMeta,formState: { ...values, server_name: `${wrapper_name}_server` },+ mode: selectedMode,tables: newTables,+ sourceSchema: values.source_schema,+ targetSchema: values.target_schema,})}@@ -101,7 +142,7 @@ export const CreateWrapperSheet = ({onSubmit={onSubmit}className="flex-grow flex flex-col h-full">- {({ handleReset, values, initialValues }: any) => {+ {({ handleReset, values, initialValues, setFieldValue }: any) => {const hasChanges = JSON.stringify(values) !== JSON.stringify(initialValues)const onClosePanel = () => {@@ -142,6 +183,7 @@ export const CreateWrapperSheet = ({/></FormSectionContent></FormSection>+ <Separator /><FormSectionheader={<FormSectionLabel>{wrapperMeta.label} Configuration</FormSectionLabel>}>@@ -158,75 +200,187 @@ export const CreateWrapperSheet = ({))}</FormSectionContent></FormSection>- <FormSection- header={- <FormSectionLabel>- <p>Foreign Tables</p>- <p className="text-foreground-light mt-2 w-[90%]">- You can query your data from these foreign tables after the wrapper is- created- </p>- </FormSectionLabel>- }- >- <FormSectionContent loading={false}>- {newTables.length === 0 ? (- <div className="flex justify-end translate-y-4">- <Button type="default" onClick={() => setIsEditingTable(true)}>- Add foreign table- </Button>- </div>- ) : (- <div className="space-y-2">- {newTables.map((table, i) => (- <div- key={`${table.schema_name}.${table.table_name}`}- className="flex items-center justify-between px-4 py-2 border rounded-md border-control"- >- <div>- <p className="text-sm">- {table.schema_name}.{table.table_name}- </p>- <p className="text-sm text-foreground-light">- Columns:{' '}- {table.columns.map((column: any) => column.name).join(', ')}- </p>- </div>- <div className="flex items-center space-x-2">- <Button- type="default"- className="px-1"- icon={<Edit />}- onClick={() => {- setIsEditingTable(true)- setSelectedTableToEdit({ ...table, tableIndex: i })- }}- />- <Button- type="default"- className="px-1"- icon={<Trash />}- onClick={() => {- setNewTables((prev) => prev.filter((_, j) => j !== i))- }}- />+ <Separator />+ <FormSection header={<FormSectionLabel>Data target</FormSectionLabel>}>+ <FormSectionContent loading={false} className="text-sm">+ <RadioGroupStacked+ value={selectedMode}+ onValueChange={(value) => setSelectedMode(value as 'tables' | 'schema')}+ >+ <RadioGroupStackedItem+ key="tables"+ value="tables"+ disabled={wrapperMeta.tables.length === 0}+ label="Tables"+ showIndicator={false}+ >+ <div className="flex gap-x-5">+ <div className="flex flex-col">+ <p className="text-foreground-light text-left">+ Define tables where the wrapper data will be shown.+ </p>+ </div>+ </div>+ {wrapperMeta.tables.length === 0 ? (+ <div className="w-full flex gap-x-2 py-2 items-center">+ <WarningIcon />+ <span className="text-xs">+ This wrapper doesn't support using foreign tables.+ </span>+ </div>+ ) : null}+ </RadioGroupStackedItem>+ <RadioGroupStackedItem+ key="schema"+ value="schema"+ disabled={+ !wrapperMeta.canTargetSchema || !hasRequiredVersionForeignSchema+ }+ label="Schema"+ showIndicator={false}+ >+ <div className="flex gap-x-5">+ <div className="flex flex-col">+ <p className="text-foreground-light text-left">+ Specify schema in which the wrapper will create tables.+ </p>+ </div>+ </div>+ {wrapperMeta.canTargetSchema ? (+ hasRequiredVersionForeignSchema ? null : (+ <div className="w-full flex gap-x-2 py-2 items-center">+ <WarningIcon />+ <span className="text-xs text-left">+ This feature requires the{' '}+ <span className="text-brand">wrappers</span> extension to be of+ minimum version of 0.5.0.+ </span></div>+ )+ ) : (+ <div className="w-full flex gap-x-2 py-2 items-center">+ <WarningIcon />+ <span className="text-xs">+ This wrapper doesn't support using a foreign schema.+ </span></div>- ))}- </div>- )}- {newTables.length > 0 && (- <div className="flex justify-end">- <Button type="default" onClick={() => setIsEditingTable(true)}>- Add foreign table- </Button>- </div>- )}- {newTables.length === 0 && formErrors.tables && (- <p className="text-sm text-right text-red-900">{formErrors.tables}</p>- )}+ )}+ </RadioGroupStackedItem>+ </RadioGroupStacked></FormSectionContent></FormSection>+ <Separator />+ {selectedMode === 'tables' && (+ <FormSection+ header={+ <FormSectionLabel>+ <p>Foreign Tables</p>+ <p className="text-foreground-light mt-2 w-[90%]">+ You can query your data from these foreign tables after the wrapper is+ created+ </p>+ </FormSectionLabel>+ }+ >+ <FormSectionContent loading={false}>+ {newTables.length === 0 ? (+ <div className="flex justify-end translate-y-4">+ <Button type="default" onClick={() => setIsEditingTable(true)}>+ Add foreign table+ </Button>+ </div>+ ) : (+ <div className="space-y-2">+ {newTables.map((table, i) => (+ <div+ key={`${table.schema_name}.${table.table_name}`}+ className="flex items-center justify-between px-4 py-2 border rounded-md border-control"+ >+ <div>+ <p className="text-sm">+ {table.schema_name}.{table.table_name}+ </p>+ <p className="text-sm text-foreground-light">+ Columns:{' '}+ {table.columns.map((column: any) => column.name).join(', ')}+ </p>+ </div>+ <div className="flex items-center space-x-2">+ <Button+ type="default"+ className="px-1"+ icon={<Edit />}+ onClick={() => {+ setIsEditingTable(true)+ setSelectedTableToEdit({ ...table, tableIndex: i })+ }}+ />+ <Button+ type="default"+ className="px-1"+ icon={<Trash />}+ onClick={() => {+ setNewTables((prev) => prev.filter((_, j) => j !== i))+ }}+ />+ </div>+ </div>+ ))}+ </div>+ )}+ {newTables.length > 0 && (+ <div className="flex justify-end">+ <Button type="default" onClick={() => setIsEditingTable(true)}>+ Add foreign table+ </Button>+ </div>+ )}+ {newTables.length === 0 && formErrors.tables && (+ <p className="text-sm text-right text-red-900">{formErrors.tables}</p>+ )}+ </FormSectionContent>+ </FormSection>+ )}+ {selectedMode === 'schema' && (+ <FormSection+ header={+ <FormSectionLabel>+ <p>Foreign Schema</p>+ <p className="text-foreground-light mt-2 w-[90%]">+ All wrapper tables will be created in the specified target schema.+ </p>+ </FormSectionLabel>+ }+ >+ <FormSectionContent loading={false}>+ {wrapperMeta.sourceSchemaOption && (+ <div>+ <InputField+ key="source_schema"+ option={wrapperMeta.sourceSchemaOption}+ loading={false}+ error={formErrors['source_schema']}+ />+ <p className="text-foreground-lighter text-sm">+ {wrapperMeta.sourceSchemaOption.description}+ </p>+ </div>+ )}+ <div className="flex flex-col gap-2">+ <Label_Shadcn_ className="text-foreground-light">+ Target Schema+ </Label_Shadcn_>+ <SchemaSelector+ portal={false}+ size="small"+ selectedSchemaName={values.target_schema}+ onSelectSchema={(schema) => setFieldValue('target_schema', schema)}+ onSelectCreateSchema={() => setCreateSchemaSheetOpen(true)}+ />+ </div>+ </FormSectionContent>+ </FormSection>+ )}</div><SheetFooter>@@ -250,6 +404,14 @@ export const CreateWrapperSheet = ({Create wrapper</Button></SheetFooter>+ <SchemaEditor+ visible={createSchemaSheetOpen}+ closePanel={() => setCreateSchemaSheetOpen(false)}+ onSuccess={(schema) => {+ setFieldValue('target_schema', schema)+ setCreateSchemaSheetOpen(false)+ }}+ /></>)}}diff --git a/apps/studio/components/interfaces/Integrations/Wrappers/InputField.tsx b/apps/studio/components/interfaces/Integrations/Wrappers/InputField.tsxindex 04f90800443..9e5d19fa4af 100644--- a/apps/studio/components/interfaces/Integrations/Wrappers/InputField.tsx+++ b/apps/studio/components/interfaces/Integrations/Wrappers/InputField.tsx@@ -68,7 +68,7 @@ const InputField = ({ option, loading, error }: InputFieldProps) => {error={error}value={loading ? 'Fetching value from Vault...' : undefined}type={!option.secureEntry || loading ? 'text' : showHidden ? 'text' : 'password'}- disabled={loading}+ disabled={loading || option.readOnly}actions={loading ? (<div className="flex items-center justify-center mr-1">diff --git a/apps/studio/components/interfaces/Integrations/Wrappers/WrapperRow.tsx b/apps/studio/components/interfaces/Integrations/Wrappers/WrapperRow.tsxindex 917a9cc87c6..1aa9b11a578 100644--- a/apps/studio/components/interfaces/Integrations/Wrappers/WrapperRow.tsx+++ b/apps/studio/components/interfaces/Integrations/Wrappers/WrapperRow.tsx@@ -67,7 +67,7 @@ const WrapperRow = ({ wrapper }: WrapperRowProps) => {return (<div key={table.id} className="flex items-center -space-x-3">- <Badge className="bg-surface-300 bg-opacity-100 pr-1 gap-2 z-[1] font-mono text-[0.75rem] h-6 text-foreground">+ <Badge className="bg-surface-300 bg-opacity-100 pr-1 gap-2 font-mono text-[0.75rem] h-6 text-foreground"><div className="relative w-3 h-3 flex items-center justify-center">{integration.icon({ className: 'p-0' })}</div>@@ -80,7 +80,7 @@ const WrapperRow = ({ wrapper }: WrapperRowProps) => {</Badge><Link href={`/project/${ref}/editor/${table.id}`}>- <Badge className="transition hover:bg-surface-300 pl-5 rounded-l-none gap-2 h-6 font-mono text-[0.75rem]">+ <Badge className="transition hover:bg-surface-300 pl-5 rounded-l-none gap-2 h-6 font-mono text-[0.75rem] border-l-0"><Table2 size={12} strokeWidth={1.5} className="text-foreground-lighter/50" />{table.schema}.{table.table_name}</Badge>diff --git a/apps/studio/components/interfaces/Integrations/Wrappers/WrapperTable.tsx b/apps/studio/components/interfaces/Integrations/Wrappers/WrapperTable.tsxindex 34338795c25..0e9fe095aaf 100644--- a/apps/studio/components/interfaces/Integrations/Wrappers/WrapperTable.tsx+++ b/apps/studio/components/interfaces/Integrations/Wrappers/WrapperTable.tsx@@ -60,7 +60,7 @@ export const WrapperTable = ({ isLatest = false }: WrapperTableProps) => {<TableHead className="w-[220px]">Name</TableHead><TableHead>Tables</TableHead><TableHead>Encrypted key</TableHead>- <TableHead className="text-right"></TableHead>+ <TableHead className="text-right w-24"></TableHead></TableRow></TableHeader><TableBody className="[&_td]:py-0 [&_tr]:h-[50px] [&_tr]:border-dotted bg-surface-100">diff --git a/apps/studio/components/interfaces/Integrations/Wrappers/Wrappers.constants.ts b/apps/studio/components/interfaces/Integrations/Wrappers/Wrappers.constants.tsindex 2472107e46e..6c46224008a 100644--- a/apps/studio/components/interfaces/Integrations/Wrappers/Wrappers.constants.ts+++ b/apps/studio/components/interfaces/Integrations/Wrappers/Wrappers.constants.ts@@ -1181,6 +1181,16 @@ export const WRAPPERS: WrapperMeta[] = [],},],+ canTargetSchema: true,+ sourceSchemaOption: {+ name: 'source_schema',+ label: 'Source Schema',+ required: true,+ encrypted: false,+ secureEntry: false,+ readOnly: true,+ defaultValue: 'stripe',+ },},{name: 'firebase_wrapper',@@ -1765,6 +1775,16 @@ export const WRAPPERS: WrapperMeta[] = [},],},+ canTargetSchema: true,+ sourceSchemaOption: {+ name: 'source_schema',+ label: 'Source Schema',+ required: true,+ encrypted: false,+ secureEntry: false,+ readOnly: true,+ defaultValue: 'cognito',+ },tables: [{label: 'Users',diff --git a/apps/studio/components/interfaces/Integrations/Wrappers/Wrappers.types.ts b/apps/studio/components/interfaces/Integrations/Wrappers/Wrappers.types.tsindex 70011183472..a47f73479e4 100644--- a/apps/studio/components/interfaces/Integrations/Wrappers/Wrappers.types.ts+++ b/apps/studio/components/interfaces/Integrations/Wrappers/Wrappers.types.ts@@ -8,14 +8,19 @@ export type WrapperMeta = {extensionName: stringlabel: stringserver: Server- tables: Table[]docsUrl: stringminimumExtensionVersion?: string+ // If true, the wrapper can target a schema which will be populated with tables specified by the wrapper..+ canTargetSchema?: boolean+ sourceSchemaOption?: ServerOption+ // Array of tables that needs to be supplied to the wrapper. If the array is empty, the wrapper should target a schema.+ tables: Table[]}export type ServerOption = {name: stringlabel: string+ description?: stringrequired: booleanencrypted: booleansecureEntry: boolean@@ -23,6 +28,7 @@ export type ServerOption = {isTextArea?: booleanurlHelper?: stringdefaultValue?: string+ readOnly?: boolean}export type Server = {diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SchemaEditor.tsx b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SchemaEditor.tsxindex 72941a1c9b1..70eb7b5648e 100644--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SchemaEditor.tsx+++ b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SchemaEditor.tsx@@ -4,20 +4,20 @@ import { Input, SidePanel } from 'ui'import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext'import { useSchemaCreateMutation } from 'data/database/schema-create-mutation'-import ActionBar from './ActionBar'interface SchemaEditorProps {visible: boolean+ onSuccess: (schema: string) => voidclosePanel: () => void}-const SchemaEditor = ({ visible, closePanel }: SchemaEditorProps) => {+const SchemaEditor = ({ visible, onSuccess, closePanel }: SchemaEditorProps) => {const { project } = useProjectContext()const [errors, setErrors] = useState<{ name?: string }>({ name: undefined })const [name, setName] = useState('')- const { mutate: createSchema } = useSchemaCreateMutation()+ const { mutateAsync: createSchema, isLoading } = useSchemaCreateMutation()useEffect(() => {if (visible) {@@ -26,51 +26,46 @@ const SchemaEditor = ({ visible, closePanel }: SchemaEditorProps) => {}}, [visible])- const onSaveChanges = (resolve: any) => {+ const onSaveChanges = async () => {const errors: any = {}if (name.length === 0) errors.name = 'Please provide a name for your schema'if (Object.keys(errors).length > 0) {- resolve()return setErrors(errors)}if (project === undefined) return console.error('Project is required')- createSchema(- { projectRef: project.ref, connectionString: project.connectionString, name },- {- onSuccess: () => {- resolve()- closePanel()- toast.success(`Successfully created schema "${name}"`)- },- }- )+ try {+ await createSchema({+ projectRef: project.ref,+ connectionString: project.connectionString,+ name,+ })+ onSuccess(name)+ toast.success(`Successfully created schema "${name}"`)+ } catch (error) {+ toast.error(`Failed to create schema: ${error}`)+ }}return (<SidePanel- size="large"+ size="medium"key="SchemaEditor"visible={visible}header={'Create a new schema'}className="transition-all duration-100 ease-in"onCancel={closePanel}- onConfirm={() => (resolve: () => void) => onSaveChanges(resolve)}- customFooter={- <ActionBar- backButtonLabel="Cancel"- applyButtonLabel="Save"- closePanel={closePanel}- applyFunction={(resolve: () => void) => onSaveChanges(resolve)}- />- }+ onConfirm={onSaveChanges}+ loading={isLoading}+ cancelText="Cancel"+ confirmText="Save"><><SidePanel.Content><div className="space-y-10 py-6"><Input- label="Name"- layout="horizontal"+ label="Schema name"+ layout="vertical"type="text"error={errors?.name}value={name}diff --git a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.tsx b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.tsxindex debbd89ef68..f15551a8c81 100644--- a/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.tsx+++ b/apps/studio/components/interfaces/TableGridEditor/SidePanelEditor/SidePanelEditor.tsx@@ -628,7 +628,11 @@ const SidePanelEditor = ({saveChanges={saveTable}updateEditorDirty={() => setIsEdited(true)}/>- <SchemaEditor visible={snap.sidePanel?.type === 'schema'} closePanel={onClosePanel} />+ <SchemaEditor+ visible={snap.sidePanel?.type === 'schema'}+ onSuccess={onClosePanel}+ closePanel={onClosePanel}+ /><JsonEditorvisible={snap.sidePanel?.type === 'json'}row={(snap.sidePanel?.type === 'json' && snap.sidePanel.jsonValue.row) || {}}diff --git a/apps/studio/data/fdw/fdw-create-mutation.ts b/apps/studio/data/fdw/fdw-create-mutation.tsindex e6a7ebbe96d..8bb75925b8d 100644--- a/apps/studio/data/fdw/fdw-create-mutation.ts+++ b/apps/studio/data/fdw/fdw-create-mutation.ts@@ -20,14 +20,23 @@ export type FDWCreateVariables = {formState: {[k: string]: string}+ mode: 'tables' | 'schema'tables: any[]+ sourceSchema: string+ targetSchema: string}export function getCreateFDWSql({wrapperMeta,formState,+ mode,tables,-}: Pick<FDWCreateVariables, 'wrapperMeta' | 'formState' | 'tables'>) {+ sourceSchema,+ targetSchema,+}: Pick<+ FDWCreateVariables,+ 'wrapperMeta' | 'formState' | 'tables' | 'mode' | 'sourceSchema' | 'targetSchema'+>) {const newSchemasSql = tables.filter((table) => table.is_new_schema).map((table) => /* SQL */ `create schema if not exists ${table.schema_name};`)@@ -103,10 +112,12 @@ export function getCreateFDWSql({const createEncryptedKeysSql = createEncryptedKeysSqlArray.join('\n')- const encryptedOptionsSqlArray = encryptedOptions.map((option) => `${option.name} ''%s''`)- const unencryptedOptionsSqlArray = unencryptedOptions.map(- (option) => `${option.name} ''${formState[option.name]}''`- )+ const encryptedOptionsSqlArray = encryptedOptions+ .filter((option) => formState[option.name])+ .map((option) => `${option.name} ''%s''`)+ const unencryptedOptionsSqlArray = unencryptedOptions+ .filter((option) => formState[option.name])+ .map((option) => `${option.name} ''${formState[option.name]}''`)const optionsSqlArray = [...encryptedOptionsSqlArray, ...unencryptedOptionsSqlArray].join(',')const createServerSql = /* SQL */ `@@ -158,12 +169,11 @@ export function getCreateFDWSql({.join('\n')}execute format(- E'create server ${formState.server_name}\\n'- ' foreign data wrapper ${formState.wrapper_name}\\n'- ' options (\\n'- ' ${optionsSqlArray}\\n'- ' );',- ${encryptedOptions.map((option) => `v_${option.name}`).join(',\n')}+ E'create server ${formState.server_name} foreign data wrapper ${formState.wrapper_name} options (${optionsSqlArray});',+ ${encryptedOptions+ .filter((option) => formState[option.name])+ .map((option) => `v_${option.name}`)+ .join(',\n')});end $$;`@@ -195,6 +205,10 @@ export function getCreateFDWSql({}).join('\n\n')+ const importForeignSchemaSql = /* SQL */ `+ import foreign schema "${sourceSchema}" from server ${formState.server_name} into ${targetSchema} options (strict 'true');+`+const sql = /* SQL */ `${newSchemasSql}@@ -204,20 +218,16 @@ export function getCreateFDWSql({${createServerSql}- ${createTablesSql}+ ${mode === 'tables' ? createTablesSql : ''}++ ${mode === 'schema' ? importForeignSchemaSql : ''}`return sql}-export async function createFDW({- projectRef,- connectionString,- wrapperMeta,- formState,- tables,-}: FDWCreateVariables) {- const sql = wrapWithTransaction(getCreateFDWSql({ wrapperMeta, formState, tables }))+export async function createFDW({ projectRef, connectionString, ...rest }: FDWCreateVariables) {+ const sql = wrapWithTransaction(getCreateFDWSql(rest))const { result } = await executeSql({ projectRef, connectionString, sql })return result}diff --git a/apps/studio/data/fdw/fdw-update-mutation.ts b/apps/studio/data/fdw/fdw-update-mutation.tsindex 761108e5d77..b079478ed8b 100644--- a/apps/studio/data/fdw/fdw-update-mutation.ts+++ b/apps/studio/data/fdw/fdw-update-mutation.ts@@ -31,7 +31,14 @@ export const getUpdateFDWSql = ({tables,}: Pick<FDWUpdateVariables, 'wrapper' | 'wrapperMeta' | 'formState' | 'tables'>) => {const deleteWrapperSql = getDeleteFDWSql({ wrapper, wrapperMeta })- const createWrapperSql = getCreateFDWSql({ wrapperMeta, formState, tables })+ const createWrapperSql = getCreateFDWSql({+ wrapperMeta,+ formState,+ tables,+ mode: 'tables',+ sourceSchema: '',+ targetSchema: '',+ })const sql = /* SQL */ `${deleteWrapperSql}diff --git a/packages/ui/src/components/radio-group-stacked.tsx b/packages/ui/src/components/radio-group-stacked.tsxindex cbc532955b9..7dac62ebf09 100644--- a/packages/ui/src/components/radio-group-stacked.tsx+++ b/packages/ui/src/components/radio-group-stacked.tsx@@ -85,7 +85,7 @@ const RadioGroupStackedItem = React.forwardRef<'-mt-[0.15rem]','text-sm transition-colors text-left','text-light',- 'group-hover:text-foreground group-data-[state=checked]:text-foreground'+ 'enabled:group-hover:text-foreground group-data-[state=checked]:text-foreground')}>{label}