The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
add with data field to branch (#37451)
Saxon Fletcher4bfdbe32ac8e
diff --git a/apps/studio/components/interfaces/BranchManagement/CreateBranchModal.tsx b/apps/studio/components/interfaces/BranchManagement/CreateBranchModal.tsxindex 67e66aae6a9..266b0a636c4 100644--- a/apps/studio/components/interfaces/BranchManagement/CreateBranchModal.tsx+++ b/apps/studio/components/interfaces/BranchManagement/CreateBranchModal.tsx@@ -42,13 +42,16 @@ import {Form_Shadcn_,Input_Shadcn_,Label_Shadcn_ as Label,+ Switch,cn,} from 'ui'import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'import { PermissionAction } from '@supabase/shared-types/out/constants'+import { useFlag } from 'hooks/ui/useFlag'export const CreateBranchModal = () => {+ const allowDataBranching = useFlag('allowDataBranching')const { ref } = useParams()const router = useRouter()const queryClient = useQueryClient()@@ -141,6 +144,7 @@ export const CreateBranchModal = () => {(val) => gitlessBranching || !githubConnection || (val && val.length > 0),'Git branch name is required when GitHub is connected'),+ withData: z.boolean().default(false).optional(),}).superRefine(async (val, ctx) => {if (val.gitBranchName && val.gitBranchName.length > 0 && githubConnection?.repository.id) {@@ -164,7 +168,7 @@ export const CreateBranchModal = () => {mode: 'onSubmit',reValidateMode: 'onBlur',resolver: zodResolver(FormSchema),- defaultValues: { branchName: '', gitBranchName: '' },+ defaultValues: { branchName: '', gitBranchName: '', withData: false },})const canSubmit = !isCreating && !isChecking@@ -184,6 +188,7 @@ export const CreateBranchModal = () => {branchName: data.branchName,is_default: false,...(data.gitBranchName ? { gitBranch: data.gitBranchName } : {}),+ ...(allowDataBranching ? { withData: data.withData } : {}),})}@@ -295,6 +300,7 @@ export const CreateBranchModal = () => {)}/>)}+{isLoadingConnections && <GenericSkeletonLoader />}{isErrorConnections && (<AlertError@@ -315,7 +321,7 @@ export const CreateBranchModal = () => {</Badge>)}</div>- <p className="text-sm text-foreground-light">+ <p className="text-sm text-foreground-lighter">Keep this preview branch in sync with a chosen GitHub branch</p></div>@@ -326,6 +332,23 @@ export const CreateBranchModal = () => {)}</>)}+ {allowDataBranching && (+ <FormField_Shadcn_+ control={form.control}+ name="withData"+ render={({ field }) => (+ <FormItemLayout+ label="Include data"+ layout="flex-row-reverse"+ description="Clone production data into this branch"+ >+ <FormControl_Shadcn_>+ <Switch checked={field.value} onCheckedChange={field.onChange} />+ </FormControl_Shadcn_>+ </FormItemLayout>+ )}+ />+ )}</DialogSection><DialogSectionSeparator />diff --git a/apps/studio/data/branches/branch-create-mutation.ts b/apps/studio/data/branches/branch-create-mutation.tsindex 7086cb8a2d4..34c25bfd014 100644--- a/apps/studio/data/branches/branch-create-mutation.ts+++ b/apps/studio/data/branches/branch-create-mutation.ts@@ -11,6 +11,7 @@ export type BranchCreateVariables = {branchName: stringgitBranch?: stringregion?: string+ withData?: boolean}export async function createBranch({@@ -19,6 +20,7 @@ export async function createBranch({branchName,gitBranch,region,+ withData,}: BranchCreateVariables) {const { data, error } = await post('/v1/projects/{ref}/branches', {params: {@@ -29,6 +31,7 @@ export async function createBranch({branch_name: branchName,git_branch: gitBranch,region: region,+ with_data: withData,},})diff --git a/apps/studio/data/projects/project-create-mutation.ts b/apps/studio/data/projects/project-create-mutation.tsindex 1e6e4c3e313..ecfeb2c20fc 100644--- a/apps/studio/data/projects/project-create-mutation.ts+++ b/apps/studio/data/projects/project-create-mutation.ts@@ -19,6 +19,9 @@ const WHITELIST_ERRORS = ['already exists in your organization.',]+type CreateProjectBody = components['schemas']['CreateProjectBody']+type CloudProvider = CreateProjectBody['cloud_provider']+export type ProjectCreateVariables = {name: stringorganizationSlug: string@@ -51,8 +54,8 @@ export async function createProject({postgresEngine,releaseChannel,}: ProjectCreateVariables) {- const body: components['schemas']['CreateProjectBody'] = {- cloud_provider: cloudProvider,+ const body: CreateProjectBody = {+ cloud_provider: cloudProvider as CloudProvider,organization_slug: organizationSlug,name,db_pass: dbPass,diff --git a/packages/api-types/types/api.d.ts b/packages/api-types/types/api.d.tsindex 1a901f0e60d..4a56c1365e3 100644--- a/packages/api-types/types/api.d.ts+++ b/packages/api-types/types/api.d.ts@@ -2450,6 +2450,11 @@ export interface components {grant_type?: 'authorization_code' | 'refresh_token'redirect_uri?: stringrefresh_token?: string+ /**+ * @description Resource indicator for MCP (Model Context Protocol) clients+ * @enum {string}+ */+ resource?: 'http://localhost:8080/mcp'}OAuthTokenResponse: {access_token: string@@ -3697,7 +3702,11 @@ export interface operations {client_id: stringcode_challenge?: stringcode_challenge_method?: 'plain' | 'sha256' | 'S256'+ /** @description Organization slug */+ organization_slug?: stringredirect_uri: string+ /** @description Resource indicator for MCP (Model Context Protocol) clients */+ resource?: 'http://localhost:8080/mcp'response_mode?: stringresponse_type: 'code' | 'token' | 'id_token token'scope?: stringdiff --git a/packages/api-types/types/platform.d.ts b/packages/api-types/types/platform.d.tsindex 23e0737d942..0eff38d7b21 100644--- a/packages/api-types/types/platform.d.ts+++ b/packages/api-types/types/platform.d.ts@@ -4702,7 +4702,8 @@ export interface components {}CreateProjectBody: {auth_site_url?: string- cloud_provider: string+ /** @enum {string} */+ cloud_provider: 'AWS' | 'FLY' | 'AWS_K8S'custom_supabase_internal_requests?: {ami: {search_tags?: {@@ -5091,7 +5092,7 @@ export interface components {}DatabaseDetailResponse: {/** @enum {string} */- cloud_provider: 'AWS' | 'AWS_K8S' | 'FLY'+ cloud_provider: 'AWS' | 'FLY' | 'AWS_K8S'/** @default null */connection_string_read_only?: string | null/** @default null */@@ -5295,10 +5296,6 @@ export interface components {file_url: stringfileUrl: string}- GetAvailableRegionsBody: {- cloud_provider: string- organization_slug: string- }GetContentCountResponse: {count: number}@@ -6390,7 +6387,8 @@ export interface components {}[]}OrganizationSlugAvailableVersionsBody: {- provider: string+ /** @enum {string} */+ provider: 'AWS' | 'FLY' | 'AWS_K8S'region: string}OrganizationSlugAvailableVersionsResponse: {@@ -7290,7 +7288,7 @@ export interface components {code: stringname: string/** @enum {string} */- provider: 'AWS' | 'AWS_K8S' | 'FLY'+ provider: 'AWS' | 'FLY' | 'AWS_K8S'/** @enum {string} */status?: 'capacity' | 'other'/** @enum {string} */@@ -7309,7 +7307,7 @@ export interface components {code: stringname: string/** @enum {string} */- provider: 'AWS' | 'AWS_K8S' | 'FLY'+ provider: 'AWS' | 'FLY' | 'AWS_K8S'/** @enum {string} */status?: 'capacity' | 'other'/** @enum {string} */@@ -11775,6 +11773,12 @@ export interface operations {'application/json': components['schemas']['InvitationResponse']}}+ 403: {+ headers: {+ [name: string]: unknown+ }+ content?: never+ }/** @description Failed to get organization invitations */500: {headers: {@@ -11806,6 +11810,12 @@ export interface operations {}content?: never}+ 403: {+ headers: {+ [name: string]: unknown+ }+ content?: never+ }/** @description Failed to create organization invitation */500: {headers: {@@ -18180,6 +18190,12 @@ export interface operations {}content?: never}+ 403: {+ headers: {+ [name: string]: unknown+ }+ content?: never+ }/** @description Failed to get project's status */500: {headers: {@@ -18253,16 +18269,15 @@ export interface operations {}ProjectsController_getRegions: {parameters: {- query?: never+ query: {+ cloud_provider: 'AWS' | 'FLY' | 'AWS_K8S'+ organization_slug: string+ }header?: neverpath?: nevercookie?: never}- requestBody: {- content: {- 'application/json': components['schemas']['GetAvailableRegionsBody']- }- }+ requestBody?: neverresponses: {200: {headers: {@@ -18293,6 +18308,12 @@ export interface operations {'application/json': components['schemas']['GetProjectByFlyExtensionIdResponse']}}+ 403: {+ headers: {+ [name: string]: unknown+ }+ content?: never+ }}}ReplicationDestinationsController_getDestinations: {