Functions

get-pooler-config

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

Get the current Supavisor connection pooler configuration.

Example

::databases ::supabase::admin::databases

poolers ::databases/get-pooler-config("my-project-ref")
map(poolers, %.pool_mode)

get-postgres-config

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

Get the Postgres configuration for a project (statement_timeout, max_connections, etc.).

Example

::databases ::supabase::admin::databases

config ::databases/get-postgres-config("my-project-ref")

get-readonly-mode

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

Check if the project database is in read-only mode.

Example

::databases ::supabase::admin::databases

mode ::databases/get-readonly-mode("my-project-ref")
mode.enabled

get-upgrade-status

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

Get the current database upgrade status.

Example

::databases ::supabase::admin::databases

upgrade ::databases/get-upgrade-status("my-project-ref")
upgrade.databaseUpgradeStatus

list-available-versions

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

List available Postgres versions for upgrade.

Example

::databases ::supabase::admin::databases

eligibility ::databases/list-available-versions("my-project-ref")
eligibility.target_upgrade_versions

list-backups

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

List database backups for a project.

Example

::databases ::supabase::admin::databases

backups ::databases/list-backups("my-project-ref")
// => [{id: "...", status: "COMPLETED", created_at: "...", ...}, ...]

list-migrations

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

List database migrations that have been run on a project.

Example

::databases ::supabase::admin::databases

migrations ::databases/list-migrations("my-project-ref")
map(migrations, %.version)

list-read-replicas

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

List read replicas for a project.

Example

::databases ::supabase::admin::databases

replicas ::databases/list-read-replicas("my-project-ref")
length(replicas)

run-query

fn (request: RunQueryRequest): Any
fn (request: RunQueryRequest, opts: Map): Any

Run a SQL query against a project's database. Requires a Personal Access Token with appropriate permissions.

Example

::databases ::supabase::admin::databases

result ::databases/run-query(::databases/RunQueryRequest({
  project_ref: "my-project-ref",
  query: "SELECT count(*) FROM auth.users"
}))

update-pooler-config

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

Update the Supavisor connection pooler configuration.

Example

::databases ::supabase::admin::databases

::databases/update-pooler-config("my-project-ref", {default_pool_size: 20})

update-postgres-config

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

Update Postgres configuration. Pass a Map of config fields (e.g. {statement_timeout: "30s", max_connections: 200}).

Example

::databases ::supabase::admin::databases

::databases/update-postgres-config("my-project-ref", {
  statement_timeout: "30s",
  max_connections: 200
})

Types

Backup

Backup type {
    id: Str?,
    status: Str?,
    created_at: Str?
}

Migration

Migration type {
    version: Str?,
    name: Str?,
    inserted_at: Str?
}

RunQueryRequest

RunQueryRequest type {
    project_ref: Str,
    query: Str
}