Functions

create-branch

fn (request: CreateBranchRequest): Branch
fn (request: CreateBranchRequest, opts: Map): Branch

Create a new preview branch. Preview branching must be enabled on the project.

Example

::branches ::supabase::admin::branches

branch ::branches/create-branch(::branches/CreateBranchRequest({
  project_ref: "my-project-ref",
  branch_name: "feat-auth",
  git_branch: "feat/auth"
}))

delete-branch

fn (branch-id: Str): Map
fn (branch-id: Str, opts: Map): Map

Delete a preview branch.

Example

::branches ::supabase::admin::branches

::branches/delete-branch("branch-id-123")

disable-preview-branching

fn (project-ref: Str): Map
fn (project-ref: Str, opts: Map): Map

Disable preview branching for a project. This deletes all existing preview branches.

Example

::branches ::supabase::admin::branches

::branches/disable-preview-branching("my-project-ref")

get-branch

fn (branch-id: Str): Branch
fn (branch-id: Str, opts: Map): Branch

Get details for a specific branch by its ID.

Example

::branches ::supabase::admin::branches

branch ::branches/get-branch("branch-id-123")
branch.status

// Per-call credentials
other ::branches/get-branch("branch-id-123", {access-token: ::hot::ctx/get("tenant_b.supabase.token")})

get-branch-config

fn (branch-id: Str): Map
fn (branch-id: Str, opts: Map): Map

Get the database configuration for a branch.

Example

::branches ::supabase::admin::branches

config ::branches/get-branch-config("branch-id-123")
config.db_host

list-branches

fn (project-ref: Str): Vec<Branch>
fn (project-ref: Str, opts: Map): Vec<Branch>

List all preview branches for a project.

Example

::branches ::supabase::admin::branches

branches ::branches/list-branches("my-project-ref")
// => [{id: "...", name: "feat-auth", git_branch: "feat/auth", status: "RUNNING_MIGRATIONS", ...}, ...]

merge-branch

fn (branch-id: Str): Map
fn (branch-id: Str, opts: Map): Map

Merge a preview branch into the parent project.

Example

::branches ::supabase::admin::branches

::branches/merge-branch("branch-id-123")

push-branch

fn (branch-id: Str): Map
fn (branch-id: Str, opts: Map): Map

Push migrations to a preview branch database.

Example

::branches ::supabase::admin::branches

::branches/push-branch("branch-id-123")

reset-branch

fn (branch-id: Str): Map
fn (branch-id: Str, opts: Map): Map

Reset a preview branch database to match the parent project.

Example

::branches ::supabase::admin::branches

::branches/reset-branch("branch-id-123")

update-branch-config

fn (request: UpdateBranchConfigRequest): Map
fn (request: UpdateBranchConfigRequest, opts: Map): Map

Update branch configuration (git branch association, reset behavior, persistence).

Example

::branches ::supabase::admin::branches

::branches/update-branch-config(::branches/UpdateBranchConfigRequest({
  branch_id: "branch-id-123",
  git_branch: "feat/auth",
  persistent: true
}))

Types

Branch

Branch type {
    id: Str,
    name: Str?,
    branch_name: Str?,
    git_branch: Str?,
    status: Str?,
    persistent: Bool?,
    reset_on_push: Bool?
}

CreateBranchRequest

CreateBranchRequest type {
    project_ref: Str,
    branch_name: Str,
    git_branch: Str?,
    region: Str?
}

UpdateBranchConfigRequest

UpdateBranchConfigRequest type {
    branch_id: Str,
    git_branch: Str?,
    reset_on_push: Bool?,
    persistent: Bool?,
    status: Str?
}