mirror of
https://github.com/supabase/supabase.git
synced 2026-12-05 16:09:06 +00:00
5709 lines
259 KiB
YAML
5709 lines
259 KiB
YAML
clispec: '002'
|
|
info:
|
|
id: cli
|
|
version: latest
|
|
title: Supabase CLI
|
|
language: sh
|
|
source: https://github.com/supabase/cli
|
|
bugs: https://github.com/supabase/cli/issues
|
|
spec: https://github.com/supabase/supabase/blob/master/apps/docs/spec/cli_v2_commands.yaml
|
|
description: Supabase CLI provides you with tools to develop your application locally, and deploy your application to the Supabase platform.
|
|
tags:
|
|
- id: quick-start
|
|
title: Quick Start
|
|
- id: local-dev
|
|
title: Local Development
|
|
- id: management-api
|
|
title: Management APIs
|
|
- id: other-commands
|
|
title: Additional Commands
|
|
flags:
|
|
- id: agent
|
|
name: --agent <[ auto | yes | no ]>
|
|
description: 'Override agent detection: yes, no, or auto'
|
|
default_value: auto
|
|
accepted_values:
|
|
- id: auto
|
|
name: auto
|
|
type: '[ auto | yes | no ]'
|
|
- id: 'yes'
|
|
name: 'yes'
|
|
type: '[ auto | yes | no ]'
|
|
- id: 'no'
|
|
name: 'no'
|
|
type: '[ auto | yes | no ]'
|
|
- id: debug
|
|
name: --debug
|
|
description: output debug logs to stderr
|
|
default_value: 'false'
|
|
- id: dns-resolver
|
|
name: --dns-resolver <[ native | https ]>
|
|
description: lookup domain names using the specified resolver
|
|
default_value: native
|
|
accepted_values:
|
|
- id: native
|
|
name: native
|
|
type: '[ native | https ]'
|
|
- id: https
|
|
name: https
|
|
type: '[ native | https ]'
|
|
- id: experimental
|
|
name: --experimental
|
|
description: enable experimental features
|
|
default_value: 'false'
|
|
- id: help
|
|
name: -h, --help
|
|
description: Show help information
|
|
default_value: 'false'
|
|
- id: network-id
|
|
name: --network-id <string>
|
|
description: use the specified docker network instead of a generated one
|
|
default_value: ''
|
|
- id: output
|
|
name: -o, --output <[ env | pretty | json | toml | yaml ]>
|
|
description: output format of status variables
|
|
default_value: pretty
|
|
accepted_values:
|
|
- id: env
|
|
name: env
|
|
type: '[ env | pretty | json | toml | yaml ]'
|
|
- id: pretty
|
|
name: pretty
|
|
type: '[ env | pretty | json | toml | yaml ]'
|
|
- id: json
|
|
name: json
|
|
type: '[ env | pretty | json | toml | yaml ]'
|
|
- id: toml
|
|
name: toml
|
|
type: '[ env | pretty | json | toml | yaml ]'
|
|
- id: yaml
|
|
name: yaml
|
|
type: '[ env | pretty | json | toml | yaml ]'
|
|
- id: output-format
|
|
name: --output-format <[ text | json | stream-json ]>
|
|
description: 'Output format: text (default), json, or stream-json (NDJSON)'
|
|
default_value: text
|
|
accepted_values:
|
|
- id: text
|
|
name: text
|
|
type: '[ text | json | stream-json ]'
|
|
- id: json
|
|
name: json
|
|
type: '[ text | json | stream-json ]'
|
|
- id: stream-json
|
|
name: stream-json
|
|
type: '[ text | json | stream-json ]'
|
|
- id: profile
|
|
name: --profile <string>
|
|
description: use a specific profile for connecting to Supabase API
|
|
default_value: supabase
|
|
- id: workdir
|
|
name: --workdir <string>
|
|
description: path to the directory containing your supabase/ folder; used exactly as given, with no ancestor directory search (defaults to searching upward from the current directory)
|
|
default_value: ''
|
|
- id: 'yes'
|
|
name: --yes
|
|
description: answer yes to all prompts; hosted changes only accept this flag or SUPABASE_YES exported in your shell, never supabase/.env or another .env file
|
|
default_value: 'false'
|
|
commands:
|
|
- id: supabase-backups
|
|
title: supabase backups
|
|
summary: Manage physical backups
|
|
description: List the physical backups of a project and restore it to a point in time (PITR).
|
|
tags:
|
|
- management-api
|
|
links: []
|
|
subcommands:
|
|
- supabase-backups-list
|
|
- supabase-backups-restore
|
|
flags: []
|
|
- id: supabase-backups-list
|
|
title: supabase backups list
|
|
summary: List available physical backups
|
|
description: |-
|
|
Show the backup status of a project, including the earliest and latest timestamps you can restore to. Use it to pick a timestamp for `supabase backups restore`.
|
|
|
|
Projects without PITR list their available backups instead.
|
|
examples:
|
|
- id: example-1
|
|
name: List all physical backups
|
|
code: supabase backups list
|
|
- id: example-2
|
|
name: List backups for a specific project
|
|
code: supabase backups list --remote=<ref>
|
|
tags: []
|
|
links: []
|
|
usage: supabase backups list [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: supabase-backups-restore
|
|
title: supabase backups restore
|
|
summary: Restore a project to a point in time
|
|
description: |-
|
|
Restore the project database to a point in time using PITR. Changes made after that time are lost.
|
|
|
|
Asks for confirmation before changing anything; pass `--yes` in scripts and CI.
|
|
examples:
|
|
- id: example-1
|
|
name: Restore to the given Unix epoch timestamp
|
|
code: supabase backups restore --timestamp 1707407047
|
|
tags: []
|
|
links: []
|
|
usage: supabase backups restore [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: timestamp
|
|
name: -t, --timestamp <int>
|
|
description: Recovery target time, as a Unix timestamp in seconds.
|
|
default_value: '0'
|
|
- id: supabase-bootstrap
|
|
title: supabase bootstrap
|
|
summary: Create a project from a starter template
|
|
description: |-
|
|
Create a new hosted Supabase project from a starter template and link it to a local directory. Use it to go from nothing to a running project with one command.
|
|
|
|
The command prompts for a working directory, downloads the template, creates the project, links it, writes its connection settings to `.env`, and pushes the template's migrations. It logs you in first if needed.
|
|
|
|
Creating a project is a hosted change, so the command asks for confirmation before it starts.
|
|
examples:
|
|
- id: example-1
|
|
name: Pick a starter template interactively
|
|
code: supabase bootstrap
|
|
- id: example-2
|
|
name: Bootstrap from a named starter template
|
|
code: supabase bootstrap my-template
|
|
tags:
|
|
- quick-start
|
|
links: []
|
|
usage: supabase bootstrap [template] [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: password
|
|
name: -p, --password <string>
|
|
description: Password for the new project's Postgres database.
|
|
default_value: ''
|
|
- id: supabase-branches
|
|
title: supabase branches
|
|
summary: Manage preview branches
|
|
description: Create, inspect, update, pause and delete the preview branches of the linked project. Each preview branch is an isolated environment for testing changes.
|
|
tags:
|
|
- management-api
|
|
links: []
|
|
subcommands:
|
|
- supabase-branches-create
|
|
- supabase-branches-delete
|
|
- supabase-branches-get
|
|
- supabase-branches-list
|
|
- supabase-branches-pause
|
|
- supabase-branches-unpause
|
|
- supabase-branches-update
|
|
flags: []
|
|
- id: supabase-branches-create
|
|
title: supabase branches create
|
|
summary: Create a preview branch
|
|
description: |-
|
|
Create a preview branch of the linked project, optionally tied to a git branch.
|
|
|
|
Pass `--with-data` to clone production data into the branch database.
|
|
examples:
|
|
- id: example-1
|
|
name: Create a preview branch
|
|
code: supabase branches create my-branch
|
|
- id: example-2
|
|
name: Create a persistent branch tied to a git branch
|
|
code: supabase branches create my-branch --git-branch feature/login --persistent
|
|
tags: []
|
|
links: []
|
|
usage: supabase branches create [name] [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: git-branch
|
|
name: --git-branch <string>
|
|
description: Git branch to associate with the new preview branch.
|
|
default_value: ''
|
|
- id: notify-url
|
|
name: --notify-url <string>
|
|
description: URL to notify when the branch is active and healthy.
|
|
default_value: ''
|
|
- id: persistent
|
|
name: --persistent
|
|
description: Create a persistent branch instead of an ephemeral one.
|
|
default_value: 'false'
|
|
- id: region
|
|
name: --region <string>
|
|
description: Region to deploy the branch database in.
|
|
default_value: ''
|
|
accepted_values:
|
|
- id: ap-east-1
|
|
name: ap-east-1
|
|
type: string
|
|
- id: ap-northeast-1
|
|
name: ap-northeast-1
|
|
type: string
|
|
- id: ap-northeast-2
|
|
name: ap-northeast-2
|
|
type: string
|
|
- id: ap-south-1
|
|
name: ap-south-1
|
|
type: string
|
|
- id: ap-southeast-1
|
|
name: ap-southeast-1
|
|
type: string
|
|
- id: ap-southeast-2
|
|
name: ap-southeast-2
|
|
type: string
|
|
- id: ca-central-1
|
|
name: ca-central-1
|
|
type: string
|
|
- id: eu-central-1
|
|
name: eu-central-1
|
|
type: string
|
|
- id: eu-central-2
|
|
name: eu-central-2
|
|
type: string
|
|
- id: eu-north-1
|
|
name: eu-north-1
|
|
type: string
|
|
- id: eu-west-1
|
|
name: eu-west-1
|
|
type: string
|
|
- id: eu-west-2
|
|
name: eu-west-2
|
|
type: string
|
|
- id: eu-west-3
|
|
name: eu-west-3
|
|
type: string
|
|
- id: sa-east-1
|
|
name: sa-east-1
|
|
type: string
|
|
- id: us-east-1
|
|
name: us-east-1
|
|
type: string
|
|
- id: us-east-2
|
|
name: us-east-2
|
|
type: string
|
|
- id: us-west-1
|
|
name: us-west-1
|
|
type: string
|
|
- id: us-west-2
|
|
name: us-west-2
|
|
type: string
|
|
- id: remote
|
|
name: --remote[=<ref>]
|
|
description: 'Target another project: --remote=<ref>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: size
|
|
name: --size <string>
|
|
description: Instance size of the branch database.
|
|
default_value: ''
|
|
accepted_values:
|
|
- id: large
|
|
name: large
|
|
type: string
|
|
- id: medium
|
|
name: medium
|
|
type: string
|
|
- id: micro
|
|
name: micro
|
|
type: string
|
|
- id: 12xlarge
|
|
name: 12xlarge
|
|
type: string
|
|
- id: 16xlarge
|
|
name: 16xlarge
|
|
type: string
|
|
- id: 24xlarge
|
|
name: 24xlarge
|
|
type: string
|
|
- id: 24xlarge_high_memory
|
|
name: 24xlarge_high_memory
|
|
type: string
|
|
- id: 24xlarge_optimized_cpu
|
|
name: 24xlarge_optimized_cpu
|
|
type: string
|
|
- id: 24xlarge_optimized_memory
|
|
name: 24xlarge_optimized_memory
|
|
type: string
|
|
- id: 2xlarge
|
|
name: 2xlarge
|
|
type: string
|
|
- id: 48xlarge
|
|
name: 48xlarge
|
|
type: string
|
|
- id: 48xlarge_high_memory
|
|
name: 48xlarge_high_memory
|
|
type: string
|
|
- id: 48xlarge_optimized_cpu
|
|
name: 48xlarge_optimized_cpu
|
|
type: string
|
|
- id: 48xlarge_optimized_memory
|
|
name: 48xlarge_optimized_memory
|
|
type: string
|
|
- id: 4xlarge
|
|
name: 4xlarge
|
|
type: string
|
|
- id: 8xlarge
|
|
name: 8xlarge
|
|
type: string
|
|
- id: small
|
|
name: small
|
|
type: string
|
|
- id: xlarge
|
|
name: xlarge
|
|
type: string
|
|
- id: with-data
|
|
name: --with-data
|
|
description: Clone production data into the branch database.
|
|
default_value: 'false'
|
|
- id: supabase-branches-delete
|
|
title: supabase branches delete
|
|
summary: Delete a preview branch
|
|
description: |-
|
|
Remove a preview branch you no longer need from the linked project.
|
|
|
|
Asks for confirmation before changing anything; pass `--yes` in scripts and CI.
|
|
examples:
|
|
- id: example-1
|
|
name: Delete a preview branch
|
|
code: supabase branches delete my-branch
|
|
- id: example-2
|
|
name: Delete a preview branch without the confirmation prompt
|
|
code: supabase branches delete my-branch --yes
|
|
tags: []
|
|
links: []
|
|
usage: supabase branches delete [name] [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref>]
|
|
description: 'Target another project: --remote=<ref>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: supabase-branches-get
|
|
title: supabase branches get
|
|
summary: Show details of a preview branch
|
|
description: |-
|
|
Show the details of a preview branch, including its connection settings.
|
|
|
|
For the main branch, the password-dependent fields (POSTGRES_URL, POSTGRES_URL_NON_POOLING) are not populated because production database credentials cannot be retrieved through the API.
|
|
examples:
|
|
- id: example-1
|
|
name: Show the details of a preview branch
|
|
code: supabase branches get my-branch
|
|
- id: example-2
|
|
name: Show the details as JSON
|
|
code: supabase branches get my-branch --output-format json
|
|
tags: []
|
|
links: []
|
|
usage: supabase branches get [name] [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref>]
|
|
description: 'Target another project: --remote=<ref>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: supabase-branches-list
|
|
title: supabase branches list
|
|
summary: List all preview branches
|
|
description: Show the preview branches of the linked project. Use it to find the name or ID that the other `branches` commands take.
|
|
examples:
|
|
- id: example-1
|
|
name: List all preview branches of the linked project
|
|
code: supabase branches list
|
|
- id: example-2
|
|
name: List preview branches as JSON
|
|
code: supabase branches list --output-format json
|
|
tags: []
|
|
links: []
|
|
usage: supabase branches list [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref>]
|
|
description: 'Target another project: --remote=<ref>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: supabase-branches-pause
|
|
title: supabase branches pause
|
|
summary: Pause a preview branch
|
|
description: |-
|
|
Pause a preview branch you are not using; resume it later with `supabase branches unpause`.
|
|
|
|
Asks for confirmation before changing anything; pass `--yes` in scripts and CI.
|
|
examples:
|
|
- id: example-1
|
|
name: Pause a preview branch
|
|
code: supabase branches pause my-branch
|
|
tags: []
|
|
links: []
|
|
usage: supabase branches pause [name] [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref>]
|
|
description: 'Target another project: --remote=<ref>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: supabase-branches-unpause
|
|
title: supabase branches unpause
|
|
summary: Unpause a preview branch
|
|
description: |-
|
|
Resume a paused preview branch so you can use it again.
|
|
|
|
Asks for confirmation before changing anything; pass `--yes` in scripts and CI.
|
|
examples:
|
|
- id: example-1
|
|
name: Resume a paused preview branch
|
|
code: supabase branches unpause my-branch
|
|
tags: []
|
|
links: []
|
|
usage: supabase branches unpause [name] [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref>]
|
|
description: 'Target another project: --remote=<ref>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: supabase-branches-update
|
|
title: supabase branches update
|
|
summary: Update a preview branch
|
|
description: |-
|
|
Rename a preview branch, change its git branch or notify URL, or switch it between ephemeral and persistent.
|
|
|
|
Asks for confirmation before changing anything; pass `--yes` in scripts and CI.
|
|
examples:
|
|
- id: example-1
|
|
name: Rename a preview branch
|
|
code: supabase branches update my-branch --name renamed-branch
|
|
- id: example-2
|
|
name: Switch a branch between ephemeral and persistent
|
|
code: supabase branches update my-branch --persistent
|
|
tags: []
|
|
links: []
|
|
usage: supabase branches update [name] [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: git-branch
|
|
name: --git-branch <string>
|
|
description: New git branch to associate with the preview branch.
|
|
default_value: ''
|
|
- id: name
|
|
name: --name <string>
|
|
description: New name for the preview branch.
|
|
default_value: ''
|
|
- id: notify-url
|
|
name: --notify-url <string>
|
|
description: URL to notify when the branch is active and healthy.
|
|
default_value: ''
|
|
- id: persistent
|
|
name: --persistent
|
|
description: Switch the branch between ephemeral and persistent.
|
|
default_value: 'false'
|
|
- id: remote
|
|
name: --remote[=<ref>]
|
|
description: 'Target another project: --remote=<ref>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: status
|
|
name: --status <string>
|
|
description: Override the current branch status.
|
|
default_value: ''
|
|
accepted_values:
|
|
- id: RUNNING_MIGRATIONS
|
|
name: RUNNING_MIGRATIONS
|
|
type: string
|
|
- id: MIGRATIONS_PASSED
|
|
name: MIGRATIONS_PASSED
|
|
type: string
|
|
- id: MIGRATIONS_FAILED
|
|
name: MIGRATIONS_FAILED
|
|
type: string
|
|
- id: FUNCTIONS_DEPLOYED
|
|
name: FUNCTIONS_DEPLOYED
|
|
type: string
|
|
- id: FUNCTIONS_FAILED
|
|
name: FUNCTIONS_FAILED
|
|
type: string
|
|
- id: supabase-completion
|
|
title: supabase completion
|
|
summary: Generate shell completion scripts
|
|
description: Print a shell completion script for `supabase` to stdout. Run the subcommand for your shell and follow its help to load the script.
|
|
tags:
|
|
- other-commands
|
|
links: []
|
|
subcommands:
|
|
- supabase-completion-bash
|
|
- supabase-completion-fish
|
|
- supabase-completion-powershell
|
|
- supabase-completion-zsh
|
|
flags: []
|
|
- id: supabase-completion-bash
|
|
title: supabase completion bash
|
|
summary: Generate the Bash completion script
|
|
description: |-
|
|
Generate the autocompletion script for the bash shell.
|
|
|
|
This script depends on the 'bash-completion' package.
|
|
If it is not installed already, you can install it via your OS's package manager.
|
|
|
|
To load completions in your current shell session:
|
|
|
|
source <(supabase completion bash)
|
|
|
|
To load completions for every new session, execute once:
|
|
|
|
#### Linux:
|
|
|
|
supabase completion bash > /etc/bash_completion.d/supabase
|
|
|
|
#### macOS:
|
|
|
|
supabase completion bash > $(brew --prefix)/etc/bash_completion.d/supabase
|
|
|
|
You will need to start a new shell for this setup to take effect.
|
|
examples:
|
|
- id: example-1
|
|
name: Load completions in the current bash session
|
|
code: source <(supabase completion bash)
|
|
tags: []
|
|
links: []
|
|
usage: supabase completion bash [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: no-descriptions
|
|
name: --no-descriptions
|
|
description: Omit descriptions from the generated completions.
|
|
default_value: 'false'
|
|
- id: supabase-completion-fish
|
|
title: supabase completion fish
|
|
summary: Generate the fish completion script
|
|
description: |-
|
|
Generate the autocompletion script for the fish shell.
|
|
|
|
To load completions in your current shell session:
|
|
|
|
supabase completion fish | source
|
|
|
|
To load completions for every new session, execute once:
|
|
|
|
supabase completion fish > ~/.config/fish/completions/supabase.fish
|
|
|
|
You will need to start a new shell for this setup to take effect.
|
|
examples:
|
|
- id: example-1
|
|
name: Load completions in the current fish session
|
|
code: supabase completion fish | source
|
|
tags: []
|
|
links: []
|
|
usage: supabase completion fish [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: no-descriptions
|
|
name: --no-descriptions
|
|
description: Omit descriptions from the generated completions.
|
|
default_value: 'false'
|
|
- id: supabase-completion-powershell
|
|
title: supabase completion powershell
|
|
summary: Generate the PowerShell completion script
|
|
description: |-
|
|
Generate the autocompletion script for powershell.
|
|
|
|
To load completions in your current shell session:
|
|
|
|
supabase completion powershell | Out-String | Invoke-Expression
|
|
|
|
To load completions for every new session, add the output of the above command
|
|
to your powershell profile.
|
|
examples:
|
|
- id: example-1
|
|
name: Load completions in the current PowerShell session
|
|
code: supabase completion powershell | Out-String | Invoke-Expression
|
|
tags: []
|
|
links: []
|
|
usage: supabase completion powershell [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: no-descriptions
|
|
name: --no-descriptions
|
|
description: Omit descriptions from the generated completions.
|
|
default_value: 'false'
|
|
- id: supabase-completion-zsh
|
|
title: supabase completion zsh
|
|
summary: Generate the Zsh completion script
|
|
description: |-
|
|
Generate the autocompletion script for the zsh shell.
|
|
|
|
If shell completion is not already enabled in your environment you will need
|
|
to enable it. You can execute the following once:
|
|
|
|
echo "autoload -U compinit; compinit" >> ~/.zshrc
|
|
|
|
To load completions in your current shell session:
|
|
|
|
source <(supabase completion zsh)
|
|
|
|
To load completions for every new session, execute once:
|
|
|
|
#### Linux:
|
|
|
|
supabase completion zsh > "${fpath[1]}/_supabase"
|
|
|
|
#### macOS:
|
|
|
|
supabase completion zsh > $(brew --prefix)/share/zsh/site-functions/_supabase
|
|
|
|
You will need to start a new shell for this setup to take effect.
|
|
examples:
|
|
- id: example-1
|
|
name: Load completions in the current zsh session
|
|
code: source <(supabase completion zsh)
|
|
tags: []
|
|
links: []
|
|
usage: supabase completion zsh [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: no-descriptions
|
|
name: --no-descriptions
|
|
description: Omit descriptions from the generated completions.
|
|
default_value: 'false'
|
|
- id: supabase-config
|
|
title: supabase config
|
|
summary: Manage project configuration
|
|
description: Compare, pull and push the settings in `supabase/config.toml` against a project or branch, to manage project configuration as code.
|
|
tags:
|
|
- management-api
|
|
links: []
|
|
subcommands:
|
|
- supabase-config-convert
|
|
- supabase-config-diff
|
|
- supabase-config-pull
|
|
- supabase-config-push
|
|
- supabase-config-validate
|
|
flags: []
|
|
- id: supabase-config-convert
|
|
title: supabase config convert
|
|
summary: Convert config.toml to config.jsonc
|
|
description: |
|
|
|
|
|
|
Converts `supabase/config.toml` to `supabase/config.jsonc` and moves the TOML file to `supabase/config.toml.bak`. Comments are carried over as `//` comments and the document gets a `$schema` entry, so editors validate it against the hosted config schema.
|
|
|
|
The conversion reads the file as written: values keep their meaning, `env(NAME)` references are copied as text, and nothing is resolved from your environment. Numbers are written in JSON form, so `0x1F` becomes `31` and `1_000` becomes `1000`. The converted document is parsed again and compared with the original before anything is written; if the two differ, the file is not valid UTF-8, or it holds a value JSON cannot represent (a TOML date, `inf` or `nan`), the command refuses and leaves `config.toml` untouched.
|
|
|
|
Comments keep their place by these rules: a comment directly above a key or table leads it; a comment block directly below a key or table, followed by a blank line or another table, trails it; a comment block with blank lines on both sides leads the next entry, or the commented-out example that follows it; a comment on the same line as a key or table header stays on that line. Comments inside a multi-line array of plain values stay beside their elements. Comments inside nested arrays or inline tables cannot be placed, so this command does not keep them in place: they move to the line above their key and the command lists each one.
|
|
|
|
Commented-out TOML examples become commented-out JSONC members, so removing the `//` from one member gives valid JSONC. A commented `# key = value` stays in the object it follows as `// "key": value,`. A commented table (`# [auth.hook.custom_access_token]` and the keys under it) is written as a commented object inside the nearest enclosing table that exists, merged with other examples under the same missing parent, and moves with the comment lines directly above it; it sits before the first later-defined entry of that table, or at the end of the table when none follows. Comments that do not parse as a single TOML key or table header stay as plain `//` comments.
|
|
|
|
Two kinds of commented example are copied as plain comments or need care when uncommented. Examples inside an array of tables (`[[name]]`, commented or not) stay as plain `//` comments. When a table lists alternative values for the same key (`# key = "a"` then `# key = "b"`), both become commented members, so uncomment only one of them.
|
|
|
|
`--dry-run` prints the converted document to stdout and writes nothing. If the project has `.vscode/settings.json`, the command also adds the schema domain to `json.schemaDownload.trustedDomains` there, keeping its comments; the file is never created.
|
|
|
|
Everyone on the project needs Supabase CLI 3.1.0 or later: older CLIs ignore `config.jsonc` and run with defaults. The command ends with a summary of the files it created, moved and updated, any relocated comments, this compatibility note and the undo command; with `--dry-run` the same summary, as a preview, goes to stderr.
|
|
|
|
If only `supabase/config.json` or `supabase/config.jsonc` exists, the command reports that there is nothing to convert and exits 0. It fails when `config.toml` and a JSON config both exist, because the JSON file takes precedence; delete it first to convert `config.toml` again. The legacy global `-o`/`--output` flag is not supported; use `--output-format json|stream-json` for a machine-readable result.
|
|
|
|
## Undo
|
|
|
|
Move the backup back and remove the JSONC file:
|
|
|
|
```sh
|
|
mv -- supabase/config.toml.bak supabase/config.toml && rm -- supabase/config.jsonc
|
|
```
|
|
|
|
If a backup from an earlier conversion already exists, the command uses the next free name (`config.toml.2.bak`, and so on). The printed undo command names that backup, with paths relative to the directory you ran the command from; on Windows it is the PowerShell equivalent.
|
|
|
|
## After converting
|
|
|
|
- Delete `supabase/config.toml.bak` once you no longer need the undo, so it is not committed. It stays outside `supabase/.temp` because `supabase unlink` and `supabase projects delete` remove that directory.
|
|
- Commit the conversion on its own. The history of the old file stays available with `git log -- supabase/config.toml`.
|
|
- Search the repository, CI workflows and Dockerfiles for `config.toml` and update any references.
|
|
- Bump pinned Supabase CLI versions (for example `supabase/setup-cli`) to 3.1.0 or later.
|
|
|
|
```sh
|
|
supabase config convert --dry-run
|
|
supabase config convert
|
|
```
|
|
examples:
|
|
- id: example-1
|
|
name: Preview the converted config.jsonc without writing it
|
|
code: supabase config convert --dry-run
|
|
- id: example-2
|
|
name: Convert supabase/config.toml to supabase/config.jsonc
|
|
code: supabase config convert
|
|
tags: []
|
|
links: []
|
|
usage: supabase config convert [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: dry-run
|
|
name: --dry-run
|
|
description: Print the converted config.jsonc to stdout without writing any file.
|
|
default_value: 'false'
|
|
- id: supabase-config-diff
|
|
title: supabase config diff
|
|
summary: Diff local config against a project
|
|
description: |
|
|
|
|
|
|
Compare your local `supabase/config.toml` with the effective configuration of a remote project or branch, to see what `config push` would change. Read-only: it never modifies the local file or any remote configuration.
|
|
|
|
Pass `--remote=<ref|branch>` to compare against a specific project, or the name (or UUID) of a branch of the currently linked project. Values that are exactly 20 lowercase letters are always treated as project refs. Without `--remote`, the linked project is the target.
|
|
|
|
`--project-ref` still works in v3 but is deprecated and removed in v4; use `--remote`. When the target ref matches the `project_id` of a `[remotes.*]` block, that block's merged config is the local side of the comparison.
|
|
|
|
Only platform-managed properties are compared. Local-stack-only sections, such as `[studio]`, `[analytics]`, `[functions]`, `[edge_runtime]`, port numbers, image version pins and `[db.migrations]`, have no hosted counterpart and are never reported, whether or not your file declares them.
|
|
|
|
Each difference is classified as one of:
|
|
|
|
- `update`: the file declares a value that differs remotely.
|
|
- `remote-only`: the remote differs while the file is silent. The shown local value is the schema default that a `config push` would write.
|
|
- `local-only`: the file declares a value that the remote did not report.
|
|
|
|
`(unset)` means the local side has no value at all. `(not returned)` means the response did not carry the property.
|
|
|
|
Secret values are never compared, because the platform only reports digests. They are listed in a masked-credentials note, as are declared properties that `config push` cannot communicate and any block the response omitted entirely.
|
|
|
|
Local values are shown as the configuration your file would produce once pushed, not its literal spelling. For example, a duration written as `"1m"` renders as `"1m0s"`, and byte sizes are shown in the units you wrote.
|
|
|
|
With `--exit-code`, the command exits `2` when any difference is found and keeps exit `1` for errors, so scripts can tell drift from failure.
|
|
|
|
Machine-readable output is available through `--output-format json|stream-json`. The payload is versioned and contains `schema_version`, `config_schema`, `target`, `scope`, `changes[]`, `masked[]`, `unmanaged[]` and `counts`, with per-change `path`s as segment arrays.
|
|
|
|
`target` identifies the compared project: `kind` (`linked`), `project_ref`, `project_name`, and `environment` (`production`, `branch` or `unverified`) when known. It also carries `parent_project_ref` for a branch, `branch` when one was named, and `local_scope` (`base` or `remotes.<name>`).
|
|
|
|
The legacy global `-o`/`--output` flag is not supported by this command; use `--output-format json|stream-json` instead.
|
|
examples:
|
|
- id: example-1
|
|
name: Diff against the linked project
|
|
code: supabase config diff
|
|
- id: example-2
|
|
name: Diff against the 'staging' branch, exiting 2 on drift
|
|
code: supabase config diff --exit-code --remote=staging
|
|
tags: []
|
|
links: []
|
|
usage: supabase config diff [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: exit-code
|
|
name: --exit-code
|
|
description: Exit with status 2 when any difference is found (errors keep exiting 1).
|
|
default_value: 'false'
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: supabase-config-pull
|
|
title: supabase config pull
|
|
summary: Pull remote config into the project config file
|
|
description: |
|
|
|
|
|
|
Write the effective configuration of a remote project or branch into your local `supabase/config.toml` or `config.json`. It is the write side of `supabase config diff`.
|
|
|
|
Every write is a surgical, format-preserving edit. Comments, key ordering and quoting elsewhere in the file are left untouched, and only the values that change are rewritten.
|
|
|
|
Pass `--remote=<ref|branch>` to pull from a specific project, or the name (or UUID) of a branch of the currently linked project. Values that are exactly 20 lowercase letters are always treated as project refs. Without `--remote`, the linked project is the target.
|
|
|
|
`--project-ref` still works in v3 but is deprecated and removed in v4; use `--remote`.
|
|
|
|
## Where values are written
|
|
|
|
Where a pulled value lands depends on whether the target is already tracked by a `[remotes.*]` block, not on how you named it. If any block's `project_id` already matches the resolved ref, that block is reused, whatever its own label, and every value lands there.
|
|
|
|
Otherwise, if the target was named as a branch, a new `[remotes.<branch-name>]` block is created. A branch resolved by UUID falls back to the project ref itself as its label. Creating a new block always writes its `project_id`, even when every other value already matches the local defaults, so that the block can be reused on a later pull.
|
|
|
|
Only when neither applies do values land at the config root. That happens when `--remote=<ref>` names a project directly, or for the linked project (a bare `--remote` or no flag) with no branch involved.
|
|
|
|
`--remote-label` overrides the block that would otherwise be reused or created. Naming a block that already tracks a different project, or naming nothing while a different block already tracks this exact ref, is an error rather than a silent overwrite.
|
|
|
|
A `[remotes.*]` block whose `project_id` is an `env(...)` reference that merely resolves to the target ref is never reused or rewritten. That is a hard error naming the variable, since a value written there would never take effect on the next load.
|
|
|
|
## Effect on the local stack
|
|
|
|
Writing to the config root can also affect `supabase start`. A handful of root-scoped settings, such as `auth.site_url`, `db.settings.*`, `db.major_version` (which changes what `supabase start` boots) and `db.pooler.*`, also govern the local stack. Pulling a hosted value into them is a real change to local dev behavior, not just a record of the hosted setting.
|
|
|
|
`config pull` warns about this rather than refusing. Writing the same value into a `[remotes.*]` block is unaffected, so `--remote-label` is the escape hatch: it diverts a root-bound pull into a `[remotes.<label>]` block and leaves local dev untouched.
|
|
|
|
## Values that are not written
|
|
|
|
Several kinds of values are never written, and are reported instead of silently skipped:
|
|
|
|
- A value whose local declaration resolves from an `env(VAR)` reference. It is reported by variable name; replace the reference yourself, or pass `--remote-label` to target a different block.
|
|
- A value the remote itself spells as an `env(VAR)` reference (`remote_env_reference`). The loader would resolve it against the local environment on the next load, so writing it verbatim would let the remote value read whatever this machine's environment holds at that name.
|
|
- Secret values, which the platform never returns in plaintext. They are listed in a masked-credentials note.
|
|
- A value the file declares that the remote does not report (`local-only`). It is never removed.
|
|
- A handful of already-declared properties that `config push` cannot communicate back at all, listed in an unmanaged note.
|
|
|
|
Local-stack-only sections, such as `[studio]`, `[analytics]`, `[functions]`, `[edge_runtime]`, port numbers and image version pins, have no hosted counterpart and are never touched.
|
|
|
|
One family of properties is written even though `config push` cannot send it back, for example `auth.oauth_server` and disabled `storage.analytics` or `storage.vector`. Pulling still records the hosted value, with a warning that it cannot be pushed back.
|
|
|
|
## Keeping the file loadable
|
|
|
|
`config pull` never writes a `config.toml` or `config.json` that it cannot load back on the next command. Pulling a value that gates other declared fields, such as turning a disabled provider's `enabled` on, also pulls its now-required sibling values in the same write, so the file never comes out half-configured.
|
|
|
|
When a sibling cannot be supplied, because the remote does not report it or a required value would still be missing, the whole toggle is skipped. It is reported as `requires values pull cannot write` in text output and `would_invalidate` in the machine payload. A note names the missing fields and, when a field is an unresolved `env(VAR)` reference, the environment variable to set before rerunning.
|
|
|
|
## Confirmation and previews
|
|
|
|
`--dry-run` prints exactly what `config diff` would show, then stops: no git check, no prompt and no write.
|
|
|
|
`--output-format json|stream-json` never prompts. It returns the confirmation's default value without reading anything, so use `--dry-run` for a preview in those formats. A non-interactive run in the default text format (no TTY on stdin) still prints the confirmation to stderr and reads a single line from piped stdin. An explicit `y`/`yes`/`n`/`no` is honored, an empty line falls back to the default, and any other answer declines.
|
|
|
|
`--yes` (or `SUPABASE_YES`) answers the confirmation prompt without asking. It does not bypass the uncommitted-changes guard: `--yes` together with uncommitted or untracked changes aborts instead of silently overwriting them, since no human is left to read the warning.
|
|
|
|
`--force` writes even when `supabase/config.toml` has uncommitted or untracked changes in git. Without it, an interactive run's prompt defaults to "no" instead of "yes", and every other case (non-interactive text, machine format, or `--yes` on any TTY) aborts outright.
|
|
|
|
A second `config pull` against an already-tracked, unchanged remote writes nothing, and never checks for uncommitted local changes in that case. A target that is not tracked yet still creates its `[remotes.*]` block on the first pull, even when every value matches the local defaults. It is the second pull against that block that writes nothing.
|
|
|
|
## Example
|
|
|
|
Given `supabase/config.toml`:
|
|
|
|
```toml
|
|
project_id = "abcdefghijklmnopqrst"
|
|
|
|
[api]
|
|
enabled = true
|
|
max_rows = 1000
|
|
```
|
|
|
|
`supabase config pull --remote=staging`, where `staging` is a branch of the linked project and no existing `[remotes.*]` block already tracks it, creates a new block at the end of the file — `max_rows` lands under its own `[remotes.staging.api]` sub-table, the same way `[api]` itself is a sub-table of the document root, not a key directly under `[remotes.staging]`:
|
|
|
|
```toml
|
|
project_id = "abcdefghijklmnopqrst"
|
|
|
|
[api]
|
|
enabled = true
|
|
max_rows = 1000
|
|
|
|
[remotes.staging]
|
|
project_id = "cccccccccccccccccccc"
|
|
|
|
[remotes.staging.api]
|
|
max_rows = 250
|
|
```
|
|
|
|
Running the same command again finds no differences and writes nothing.
|
|
|
|
Machine-readable output is available through `--output-format json|stream-json`. The payload is versioned and contains `schema_version`, `config_schema`, `config_path`, `format`, `target`, `destination`, `dry_run`, `wrote`, `scope`, `changes[]`, `warnings[]`, `masked[]`, `unmanaged[]` and `counts`.
|
|
|
|
`target` identifies the pulled project the same way `config diff` does: `kind`, `project_ref`, `project_name`, `environment`, `parent_project_ref`, `branch` and `local_scope`. Per-change `path`s are segment arrays, and each change carries `written` and, when unwritten, a `skipped_reason` (`env_reference | local_only | remote_env_reference | unwritable | would_invalidate | declined | dry_run`).
|
|
|
|
A `would_invalidate` warning additionally carries `missing_fields` (`[{path, env_variable?}]`) naming what blocked the family. The payload spells the root scope `"base"` (`target.local_scope`), while text output calls the same thing `config root`.
|
|
|
|
The legacy global `-o`/`--output` flag is not supported by this command; use `--output-format json|stream-json` instead.
|
|
examples:
|
|
- id: example-1
|
|
name: Pull from the linked project into the config root
|
|
code: supabase config pull
|
|
- id: example-2
|
|
name: Pull from the 'staging' branch into remotes.staging
|
|
code: supabase config pull --remote=staging
|
|
- id: example-3
|
|
name: Preview the changes without writing the config file
|
|
code: supabase config pull --dry-run
|
|
tags: []
|
|
links: []
|
|
usage: supabase config pull [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: dry-run
|
|
name: --dry-run
|
|
description: Show what would be written without touching the config file.
|
|
default_value: 'false'
|
|
- id: force
|
|
name: --force
|
|
description: Write even when the project config file has uncommitted changes in git.
|
|
default_value: 'false'
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: remote-label
|
|
name: --remote-label <string>
|
|
description: Name of the `[remotes.*]` block to write into, overriding the block that would otherwise be reused or created.
|
|
default_value: ''
|
|
- id: supabase-config-push
|
|
title: supabase config push
|
|
summary: Push local config to a project
|
|
description: |
|
|
|
|
|
|
Update the linked project, or one of its branches, with the properties your local `supabase/config.toml` declares. This lets you manage project configuration as code. Properties the file does not declare are left unchanged.
|
|
|
|
Pass `--remote=<ref|branch>` to push to a specific project, or the name (or UUID) of a branch of the currently linked project. Values that are exactly 20 lowercase letters are always treated as project refs. Without `--remote`, the linked project is the target.
|
|
|
|
`--project-ref` still works in v3 but is deprecated and removed in v4; use `--remote`.
|
|
|
|
Before anything is pushed, the command prints the `Target:` line for the resolved project or branch (name, ref, and for a branch its parent project). It then shows the exact diff for every resource that will change. If a change enables a paid add-on, its price is printed before the question.
|
|
|
|
The command asks once, with one question covering every changed resource and a default answer of no. It sends nothing until you confirm. A push with nothing to change never asks, and declining fails the command and writes nothing.
|
|
|
|
Piped answers are never read, so a script, a JSON run (`-o json`, `--output-format json`) or an agent must pass `--yes` or set `SUPABASE_YES` in the shell. A `SUPABASE_YES` in `supabase/.env` does not count. With `--yes` the command echoes `Confirmed by --yes: …` to stderr and pushes.
|
|
|
|
In `json` output the result carries a `target` object with the resolved identity (`kind`, `project_ref`, `project_name`, `environment`, and `parent_project_ref` for a branch) next to the push summary.
|
|
examples:
|
|
- id: example-1
|
|
name: Push local config to the linked project
|
|
code: supabase config push
|
|
- id: example-2
|
|
name: Push local config to a specific project
|
|
code: supabase config push --remote=abcdefghijklmnopqrst
|
|
- id: example-3
|
|
name: Push local config to the 'staging' branch
|
|
code: supabase config push --remote=staging
|
|
tags: []
|
|
links: []
|
|
usage: supabase config push [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: supabase-config-validate
|
|
title: supabase config validate
|
|
summary: Validate the project config file
|
|
description: |
|
|
|
|
|
|
Checks the project config file (`supabase/config.toml`, `config.json` or `config.jsonc`) and reports every problem in one pass, each with its key path and `file:line:column`. It never modifies a project file and never contacts the Supabase API.
|
|
|
|
## What is checked
|
|
|
|
1. The file parses (TOML or JSONC).
|
|
2. The schema version is one this CLI reads.
|
|
3. Only one config file applies: `config.json` and `config.jsonc` together is an error, and `config.toml` next to a JSON file is reported as shadowed (the JSON file is the one used).
|
|
4. With `--resolve-env` only, the `.env*` files load.
|
|
5. Removed keys, unknown keys (with a `did you mean` suggestion when one is close), values of the wrong type, enum or range, and missing required keys.
|
|
6. The config rules `supabase start` applies before it touches Docker, such as a missing provider secret or an unreadable `content_path` file. This does not cover Docker, ports or image pulls.
|
|
7. Every `[remotes.<name>]` block, merged over the base config. Its problems carry the remote name, and a problem the base already has is reported once.
|
|
|
|
Stages 1 to 3 and, with `--resolve-env`, stage 4 stop the run when they fail, because later checks cannot be computed; the report says where it stopped (`complete: false`, `stopped_at` in JSON). Everything from stage 5 on is reported together. `complete` is also `false` when a whole table had to be treated as unknown.
|
|
|
|
## Secrets
|
|
|
|
The report shows key paths and `file:line:column`, never source text or values, in text and JSON alike (see [ADR 0034](https://github.com/supabase/cli/blob/develop/docs/adr/0034-config-diagnostics-print-no-source-text.md)). Environment variables are read only with `--resolve-env`, and `SUPABASE_*` key overrides are never read: the command validates the file as committed.
|
|
|
|
## `env()` references
|
|
|
|
By default the command never reads the shell or any `.env*` file. A value written as `env(NAME)` is unknown: it is never an error by itself, and a check that reads it is not run. The report says how many values come from `env()` and how many checks were not run, and JSON lists them in `deferred` (`check`, `remote`, `waits_on`) with the count in `unknown_values`.
|
|
|
|
With `--resolve-env` the command reads the shell and the `.env*` files (`supabase/` then the project root, selected by `SUPABASE_ENV`) and checks each value like a literal. A set value is validated and never printed. A variable that is unset (`env_unset`) or empty (`env_empty`, including a shell variable set to `""`, which hides a `.env` value) is reported with every place it is used, for example `NAME is not set. It is used at 12:3, 40:7`. It is an error when a check could not run without it or when it feeds a key that only accepts a number, boolean or one of a fixed set of values, and a warning otherwise. Warnings never change the exit code. An unreadable or unparseable `.env*` file stops the run at `env_file`.
|
|
|
|
## Two config files
|
|
|
|
`config.json` and `config.jsonc` together is an error. `config.toml` next to a JSON file reports `shadowed_file`.
|
|
|
|
## Example
|
|
|
|
```text
|
|
✗ db.major_version unsupported Postgres version
|
|
supabase/config.toml:9:17
|
|
help: use one of 14, 15, 17
|
|
|
|
✗ 1 error in supabase/config.toml
|
|
```
|
|
|
|
```json
|
|
{
|
|
"schema_version": 1,
|
|
"valid": false,
|
|
"complete": true,
|
|
"file": "supabase/config.toml",
|
|
"format": "toml",
|
|
"remotes": [],
|
|
"unknown_values": 0,
|
|
"deferred": [],
|
|
"errors": [
|
|
{
|
|
"code": "invalid_value",
|
|
"severity": "error",
|
|
"key": "db.major_version",
|
|
"path": "db.major_version",
|
|
"reason": "unsupported Postgres version",
|
|
"help": "use one of 14, 15, 17",
|
|
"line": 9,
|
|
"column": 17,
|
|
"end_line": 9,
|
|
"end_column": 19
|
|
}
|
|
],
|
|
"warnings": [],
|
|
"message": "supabase/config.toml has 1 problem"
|
|
}
|
|
```
|
|
|
|
Problem codes: `syntax`, `file_conflict`, `schema_version`, `removed_key`, `unknown_key`, `invalid_type`, `invalid_enum`, `invalid_value`, `missing_required`, `remote_project_id`, `env_file`, `env_unset`, `env_empty`, `deprecated_key`, `shadowed_file`, `unrecognized_schema`. Failures before a report exists (no config file, bad `--workdir`) use the generic `{"_tag":"Error",...}` envelope.
|
|
|
|
The exit code is `0` when valid and `1` when there are errors. `-o/--output` is not supported; use `--output-format`.
|
|
|
|
## CI and pre-commit
|
|
|
|
```yaml
|
|
- run: supabase config validate
|
|
```
|
|
|
|
```yaml
|
|
repos:
|
|
- repo: local
|
|
hooks:
|
|
- id: supabase-config-validate
|
|
name: supabase config validate
|
|
entry: supabase config validate
|
|
language: system
|
|
files: ^supabase/config\.(toml|jsonc?)$
|
|
pass_filenames: false
|
|
```
|
|
|
|
```sh
|
|
supabase config validate
|
|
supabase config validate --workdir path/to/project
|
|
supabase config validate --output-format json
|
|
supabase config validate --resolve-env
|
|
```
|
|
examples:
|
|
- id: example-1
|
|
name: Validate supabase/config.toml, config.json or config.jsonc
|
|
code: supabase config validate
|
|
- id: example-2
|
|
name: Validate the config of another project directory
|
|
code: supabase config validate --workdir path/to/project
|
|
- id: example-3
|
|
name: Print the report as JSON for scripts and agents
|
|
code: supabase config validate --output-format json
|
|
- id: example-4
|
|
name: Also check the values that env() references take from the shell and .env files
|
|
code: supabase config validate --resolve-env
|
|
tags: []
|
|
links: []
|
|
usage: supabase config validate [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: resolve-env
|
|
name: --resolve-env
|
|
description: Read the shell and .env files, and check the values env() references supply. Without it, env() values are left unchecked.
|
|
default_value: 'false'
|
|
- id: supabase-db
|
|
title: supabase db
|
|
summary: Manage databases
|
|
description: 'Work with the Postgres database of your local stack or a hosted project: diff and pull schema changes, push migrations, dump data, lint, query, and reset.'
|
|
tags:
|
|
- local-dev
|
|
links: []
|
|
subcommands:
|
|
- supabase-db-advisors
|
|
- supabase-db-diff
|
|
- supabase-db-dump
|
|
- supabase-db-lint
|
|
- supabase-db-pull
|
|
- supabase-db-push
|
|
- supabase-db-query
|
|
- supabase-db-reset
|
|
- supabase-db-schema
|
|
- supabase-db-start
|
|
flags: []
|
|
- id: supabase-db-advisors
|
|
title: supabase db advisors
|
|
summary: Check a database for security and performance issues
|
|
description: |
|
|
|
|
|
|
Check a database for common security and performance issues, such as missing RLS policies, unindexed foreign keys, and an exposed `auth.users`. Run it before a release or in CI.
|
|
|
|
It inspects the local database by default. Pass `--remote` for the linked project, or `--remote=<ref|branch|url>` for another project, a branch of the linked project, or a database URL. The command prints a `Target:` line on stderr naming the database it resolved, and never asks for confirmation.
|
|
|
|
`--linked`, `--project-ref`, `--db-url` and `--local` still work in v3 but are deprecated and removed in v4; use `--remote`.
|
|
examples:
|
|
- id: example-1
|
|
name: Check the local database
|
|
code: supabase db advisors
|
|
- id: example-2
|
|
name: Check the linked project for security issues only
|
|
code: supabase db advisors --remote --type security
|
|
- id: example-3
|
|
name: Fail a CI run when an error-level issue is found
|
|
code: supabase db advisors --level error --fail-on error
|
|
tags: []
|
|
links: []
|
|
usage: supabase db advisors [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: fail-on
|
|
name: --fail-on <[ none | info | warn | error ]>
|
|
description: Issue level at which the command exits with a non-zero status.
|
|
default_value: none
|
|
accepted_values:
|
|
- id: none
|
|
name: none
|
|
type: '[ none | info | warn | error ]'
|
|
- id: info
|
|
name: info
|
|
type: '[ none | info | warn | error ]'
|
|
- id: warn
|
|
name: warn
|
|
type: '[ none | info | warn | error ]'
|
|
- id: error
|
|
name: error
|
|
type: '[ none | info | warn | error ]'
|
|
- id: level
|
|
name: --level <[ info | warn | error ]>
|
|
description: Minimum issue level to display.
|
|
default_value: warn
|
|
accepted_values:
|
|
- id: info
|
|
name: info
|
|
type: '[ info | warn | error ]'
|
|
- id: warn
|
|
name: warn
|
|
type: '[ info | warn | error ]'
|
|
- id: error
|
|
name: error
|
|
type: '[ info | warn | error ]'
|
|
- id: remote
|
|
name: --remote[=<ref|branch|url>]
|
|
description: 'Target a remote database: the linked project, or --remote=<ref|branch|url>.'
|
|
default_value: 'false'
|
|
- id: type
|
|
name: --type <[ all | security | performance ]>
|
|
description: Type of advisors to check.
|
|
default_value: all
|
|
accepted_values:
|
|
- id: all
|
|
name: all
|
|
type: '[ all | security | performance ]'
|
|
- id: security
|
|
name: security
|
|
type: '[ all | security | performance ]'
|
|
- id: performance
|
|
name: performance
|
|
type: '[ all | security | performance ]'
|
|
- id: supabase-db-diff
|
|
title: supabase db diff
|
|
summary: Diff a database for schema changes
|
|
description: |
|
|
|
|
|
|
Show the schema changes between the migrations in `supabase/migrations` and a live database. Use it to turn changes you made in a database into a new migration.
|
|
|
|
It compares the target database with a shadow database built from your local migrations, using the bundled pg-delta engine by default. The target is the local database, which requires the local development stack to be running. Pass `--remote` to diff the linked project, or `--remote=<ref|branch|url>` to diff another project, a branch of the linked project, or a database URL such as a self-hosted database.
|
|
|
|
The command prints a `Target:` line on stderr naming the database it resolved, and never asks for confirmation.
|
|
|
|
`--linked`, `--project-ref`, `--db-url` and `--local` still work in v3 but are deprecated and removed in v4; use `--remote`.
|
|
|
|
Output is written to stdout by default. Pass `-f <name>` to save the complete diff as a new migration file instead. All schemas are diffed unless you restrict them with `--schema public,extensions`.
|
|
|
|
## Comparing two sources
|
|
|
|
With `--from` and `--to`, you can diff any two of `local`, `migrations`, the linked project (`remote`), a project ref, a branch, or a Postgres URL. This mode always uses pg-delta, and `--remote` cannot be combined with it. The deprecated aliases still work here and warn: `--project-ref` points a `remote` side at the project it names, and the rest change nothing.
|
|
|
|
In this mode, `-f` is ignored and the output on stdout (or in `--output`) is flattened SQL for review, not a portable apply script. Do not apply it with plain `psql -f`: transactional units can contain `SET LOCAL` preambles that only take effect inside a transaction, and plans that mix transactional and non-transactional units cannot safely be wrapped in one transaction.
|
|
|
|
To create a migration you can apply, use `supabase db diff -f <name>`. Then apply it with `supabase db reset` locally or `supabase db push --remote` against the linked project, which preserve the plan's per-unit transaction semantics.
|
|
|
|
## Diff engines
|
|
|
|
pg-delta is the default engine. The legacy [djrobstep/migra](https://github.com/djrobstep/migra) engine, which runs in a container, is still available. To fall back to it, set `enabled = false` under `[experimental.pgdelta]` in `config.toml`, or pass `--use-migra` for a single run.
|
|
|
|
With pg-delta, `[db.migrations] schema_paths` and declarative schema files such as `supabase/schemas` are not inputs: the command always compares local migrations with the selected database. `db diff -f` prints a note with next steps when it finds declarative files it did not read. To generate a migration from declarative schema files, use `supabase db schema declarative sync`.
|
|
|
|
When migra diffs the local database and declarative schema files exist, it diffs against those files instead of the live database. It picks them in this order: `[db.migrations] schema_paths` when set; otherwise the `declarative_schema_path` directory while `[experimental.pgdelta] enabled` is true (so with `--use-migra` and the default config); otherwise `supabase/schemas`. Setting `enabled = false` therefore makes migra skip a custom `declarative_schema_path` and fall back to `supabase/schemas`.
|
|
|
|
pg-delta formats diff SQL with uppercase keywords, indent 2, a maximum width of 180, trailing commas, and column and key alignment, matching its declarative export. Configure overrides with `[experimental.pgdelta] format_options`, or set `format_options = "null"` to emit raw statements.
|
|
|
|
When `-f` writes migrations, execution-aware transaction semantics are preserved as ordered per-unit files. Non-transactional units carry a directive that the CLI apply path honors. Flattened review output keeps the rendered SQL and preambles, but not the unit boundaries a migration runner needs.
|
|
|
|
## Limitations
|
|
|
|
Storage buckets are data, not schema, so no diff engine captures them. Under the legacy migra engine, the diff can also miss:
|
|
|
|
- Changes to publication
|
|
- Views with `security_invoker` attributes
|
|
examples:
|
|
- id: basic-usage
|
|
name: Basic usage
|
|
code: supabase db diff -f my_table
|
|
response: |
|
|
Target: local stack (127.0.0.1:54322)
|
|
Creating shadow database...
|
|
Applying migration 20230425064254_remote_commit.sql...
|
|
Diffing schemas: auth,extensions,public,storage
|
|
Finished supabase db diff on branch main.
|
|
|
|
No schema changes found
|
|
- id: linked-project
|
|
name: Against linked project
|
|
code: supabase db diff -f my_table --remote
|
|
response: |
|
|
Target: project My Project (abcdefghijklmnopqrst) · production
|
|
Creating shadow database...
|
|
Diffing schemas: auth,extensions,public,storage
|
|
Finished supabase db diff on branch main.
|
|
|
|
WARNING: The diff tool is not foolproof, so you may need to manually rearrange and modify the generated migration.
|
|
Run supabase db reset to verify that the new migration does not generate errors.
|
|
- id: specific-schema
|
|
name: For a specific schema
|
|
code: supabase db diff -f my_table --schema auth
|
|
response: |
|
|
Target: local stack (127.0.0.1:54322)
|
|
Creating shadow database...
|
|
Diffing schemas: auth
|
|
Finished supabase db diff on branch main.
|
|
|
|
No schema changes found
|
|
tags: []
|
|
links: []
|
|
usage: supabase db diff [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: file
|
|
name: -f, --file <string>
|
|
description: Save the complete schema diff as a new migration with this name; ignored with --from and --to.
|
|
default_value: ''
|
|
- id: from
|
|
name: --from <string>
|
|
description: 'Source of the diff: local, migrations, remote (always the linked project), a project ref, a branch, or a Postgres URL.'
|
|
default_value: ''
|
|
- id: output
|
|
name: -o, --output <string>
|
|
description: Write the flattened diff SQL of --from and --to mode to a file for review; it is not a portable apply script.
|
|
default_value: ''
|
|
- id: remote
|
|
name: --remote[=<ref|branch|url>]
|
|
description: 'Target a remote database: the linked project, or --remote=<ref|branch|url>.'
|
|
default_value: 'false'
|
|
- id: schema
|
|
name: -s, --schema <strings>
|
|
description: Comma-separated list of schemas to include.
|
|
default_value: '[]'
|
|
- id: strict-coverage
|
|
name: --strict-coverage
|
|
description: Fail when pg-delta finds schema objects it cannot manage, instead of leaving them unmanaged.
|
|
default_value: 'false'
|
|
- id: to
|
|
name: --to <string>
|
|
description: 'Target of the diff: local, migrations, remote (always the linked project), a project ref, a branch, or a Postgres URL.'
|
|
default_value: ''
|
|
- id: use-migra
|
|
name: --use-migra
|
|
description: Use the legacy migra engine to generate the schema diff.
|
|
default_value: 'false'
|
|
- id: use-pg-delta
|
|
name: --use-pg-delta
|
|
description: Use pg-delta to generate the schema diff.
|
|
default_value: 'false'
|
|
- id: use-pgadmin
|
|
name: --use-pgadmin
|
|
description: Use pgAdmin to generate the schema diff.
|
|
default_value: 'false'
|
|
- id: supabase-db-dump
|
|
title: supabase db dump
|
|
summary: Dump data or schemas from a database
|
|
description: |
|
|
|
|
|
|
Export the schema of a database as a SQL script, or its data or custom roles with `--data-only` and `--role-only`. Use it to back up a database or to copy it to another project.
|
|
|
|
It dumps the local database by default. Pass `--remote` to dump the linked project, which requires your local project to be linked by running `supabase link`. Pass `--remote=<ref|branch|url>` to dump another project, a branch of the linked project, or a database URL such as a self-hosted database.
|
|
|
|
The command prints a `Target:` line on stderr naming the database it resolved, and never asks for confirmation.
|
|
|
|
`--linked`, `--project-ref`, `--db-url` and `--local` still work in v3 but are deprecated and removed in v4; use `--remote`.
|
|
|
|
The command runs `pg_dump` in a container and excludes Supabase-managed schemas, including `auth`, `storage`, and those created by extensions. The default dump contains neither data nor custom roles.
|
|
|
|
### Note on privilege migration
|
|
|
|
When you restore to a new project, tables inherit ALL privileges from the default privileges in the target database. To keep specific privileges from your dump, revoke the defaults before restoring:
|
|
|
|
```sql
|
|
-- Run BEFORE restoring your schema
|
|
ALTER DEFAULT PRIVILEGES IN SCHEMA public REVOKE ALL ON TABLES FROM anon, authenticated;
|
|
```
|
|
examples:
|
|
- id: basic-usage
|
|
name: Basic usage
|
|
code: supabase db dump -f supabase/schema.sql
|
|
response: |
|
|
Target: local stack (127.0.0.1:54322)
|
|
Dumping schemas from local database...
|
|
Dumped schema to supabase/schema.sql.
|
|
- id: linked-project
|
|
name: Dump the linked project
|
|
code: supabase db dump -f supabase/schema.sql --remote
|
|
response: |
|
|
Target: project My Project (abcdefghijklmnopqrst) · production
|
|
Dumping schemas from remote database...
|
|
Dumped schema to supabase/schema.sql.
|
|
- id: role-only
|
|
name: Role only
|
|
code: supabase db dump -f supabase/roles.sql --role-only --remote
|
|
response: |
|
|
Target: project My Project (abcdefghijklmnopqrst) · production
|
|
Dumping roles from remote database...
|
|
Dumped schema to supabase/roles.sql.
|
|
- id: data-only
|
|
name: Data only
|
|
code: supabase db dump -f supabase/seed.sql --data-only --remote
|
|
response: |
|
|
Target: project My Project (abcdefghijklmnopqrst) · production
|
|
Dumping data from remote database...
|
|
Dumped schema to supabase/seed.sql.
|
|
tags: []
|
|
links: []
|
|
usage: supabase db dump [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: data-only
|
|
name: --data-only
|
|
description: Dump only data records.
|
|
default_value: 'false'
|
|
- id: dry-run
|
|
name: --dry-run
|
|
description: Print the pg_dump script that would run, without running it.
|
|
default_value: 'false'
|
|
- id: exclude
|
|
name: -x, --exclude <strings>
|
|
description: Comma-separated list of schema.table names to exclude from a data-only dump.
|
|
default_value: '[]'
|
|
- id: file
|
|
name: -f, --file <string>
|
|
description: File path to save the dumped contents to.
|
|
default_value: ''
|
|
- id: keep-comments
|
|
name: --keep-comments
|
|
description: Keep commented lines from the pg_dump output.
|
|
default_value: 'false'
|
|
- id: password
|
|
name: -p, --password <string>
|
|
description: Database password for the project selected with --remote; ignored for the local database and database URLs.
|
|
default_value: ''
|
|
- id: remote
|
|
name: --remote[=<ref|branch|url>]
|
|
description: 'Target a remote database: the linked project, or --remote=<ref|branch|url>.'
|
|
default_value: 'false'
|
|
- id: role-only
|
|
name: --role-only
|
|
description: Dump only cluster roles.
|
|
default_value: 'false'
|
|
- id: schema
|
|
name: -s, --schema <strings>
|
|
description: Comma-separated list of schemas to include.
|
|
default_value: '[]'
|
|
- id: use-copy
|
|
name: --use-copy
|
|
description: Use COPY statements instead of INSERT statements.
|
|
default_value: 'false'
|
|
- id: supabase-db-lint
|
|
title: supabase db lint
|
|
summary: Check a database for schema errors
|
|
description: |
|
|
|
|
|
|
Find errors in your database functions by running the `plpgsql_check` extension against all schemas. Use it to catch mistakes before you push a migration.
|
|
|
|
It lints the local database by default, which requires the local development stack to be running. Pass `--remote` to lint the linked project, or `--remote=<ref|branch|url>` to lint another project, a branch of the linked project, or a database URL such as a self-hosted database. The command prints a `Target:` line on stderr naming the database it resolved, and never asks for confirmation.
|
|
|
|
`--linked`, `--project-ref`, `--db-url` and `--local` still work in v3 but are deprecated and removed in v4; use `--remote`.
|
|
|
|
The default lint level is `warning`. Raise it to `error` with `--level`, and lint only some schemas with `--schema`.
|
|
|
|
Use `--fail-on` to control when the command exits with a non-zero status, which is useful in CI/CD pipelines. The possible values are:
|
|
|
|
- `none` (default): Always exit with a zero status code, regardless of lint results.
|
|
- `warning`: Exit with a non-zero status code if any warnings or errors are found.
|
|
- `error`: Exit with a non-zero status code only if errors are found.
|
|
examples:
|
|
- id: basic-usage
|
|
name: Basic usage
|
|
code: supabase db lint
|
|
response: |
|
|
Linting schema: public
|
|
|
|
No schema errors found
|
|
- id: schema-warnings
|
|
name: Warnings for a specific schema
|
|
code: supabase db lint --level warning --schema storage
|
|
response: |
|
|
Linting schema: storage
|
|
[
|
|
{
|
|
"function": "storage.search",
|
|
"issues": [
|
|
{
|
|
"level": "warning",
|
|
"message": "unused variable \"_bucketid\"",
|
|
"sqlState": "00000"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
tags: []
|
|
links: []
|
|
usage: supabase db lint [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: fail-on
|
|
name: --fail-on <[ none | warning | error ]>
|
|
description: Lint level at which the command exits with a non-zero status.
|
|
default_value: none
|
|
accepted_values:
|
|
- id: none
|
|
name: none
|
|
type: '[ none | warning | error ]'
|
|
- id: warning
|
|
name: warning
|
|
type: '[ none | warning | error ]'
|
|
- id: error
|
|
name: error
|
|
type: '[ none | warning | error ]'
|
|
- id: level
|
|
name: --level <[ warning | error ]>
|
|
description: Minimum lint level to report.
|
|
default_value: warning
|
|
accepted_values:
|
|
- id: warning
|
|
name: warning
|
|
type: '[ warning | error ]'
|
|
- id: error
|
|
name: error
|
|
type: '[ warning | error ]'
|
|
- id: remote
|
|
name: --remote[=<ref|branch|url>]
|
|
description: 'Target a remote database: the linked project, or --remote=<ref|branch|url>.'
|
|
default_value: 'false'
|
|
- id: schema
|
|
name: -s, --schema <strings>
|
|
description: Comma-separated list of schemas to include.
|
|
default_value: '[]'
|
|
- id: supabase-db-pull
|
|
title: supabase db pull
|
|
summary: Pull schema from a database
|
|
description: |
|
|
Pull schema changes from a database into a new migration file in `supabase/migrations`. Use it to capture changes made outside your migrations, such as in the dashboard.
|
|
|
|
It pulls from the local database by default. Pass `--remote` to pull from the linked project, which requires your local project to be linked by running `supabase link`. Pass `--remote=<ref|branch|url>` to pull from another project, a branch of the linked project, or a database URL such as a self-hosted database.
|
|
|
|
In a linked checkout, a run without `--remote` prints a hint naming the linked project. The command prints a `Target:` line on stderr naming the database it resolved.
|
|
|
|
`--linked`, `--project-ref`, `--db-url` and `--local` still work in v3 but are deprecated and removed in v4; use `--remote`.
|
|
|
|
> Note this command requires Docker Desktop (or a running Docker daemon), as it starts a local Postgres container to diff the schema you pull.
|
|
|
|
After the migration file is written, a new row is inserted into the migration history table to reflect the current state of the database. A hosted database asks for one confirmation first (default No), after the diff and before any file is written; declining stops the command without writing anything. Non-interactive, JSON and agent runs need `--yes` (or `SUPABASE_YES` in the shell environment, not in `supabase/.env`).
|
|
|
|
A pull from the local database and `--declarative` ask nothing.
|
|
|
|
If no entries exist in the migration history table, pg-delta (the default diff engine) produces the full migration from the shadow diff alone; with `--diff-engine migra`, the initial pull instead uses `pg_dump` to capture all contents of the schemas you have created. Otherwise, this command will only diff schema changes against the target database, similar to running `db diff --remote`.
|
|
|
|
Pass `--declarative` to switch to the declarative pg-delta export workflow instead of writing a migration file. The tree lives in `supabase/schemas` by default. Change the location with `experimental.pgdelta.declarative_schema_path`.
|
|
|
|
On a project that falls back to the legacy migra engine, don't use `--declarative`. The export also points `[db.migrations].schema_paths` at the tree it writes. The next local `db diff` applies those files in lexicographic order without resolving dependencies between them, so it fails when a file sorts before an object it depends on.
|
|
|
|
If you've already run it, re-enable pg-delta, or undo both changes:
|
|
|
|
1. Delete the files the export wrote to the declarative directory (`supabase/schemas/` by default). Files that were already there are left in place.
|
|
2. Restore `[db.migrations].schema_paths` in `config.toml` to its previous value, or remove it if the export added it.
|
|
|
|
pg-delta plans are execution-aware: when a plan crosses a transaction boundary — for example `ALTER TYPE ... ADD VALUE` followed by a statement that uses the new enum value, which cannot run in the same transaction — `db pull` writes one ordered migration file per plan unit instead of a single file (for example `<ts>_remote_schema_1.sql` and `<ts+1s>_remote_schema_2.sql`), each recorded in the migration history. Units whose statements cannot run inside a transaction start with a `-- pg-delta: transaction=false` directive that the CLI apply paths honor. The common case (a single unit) still produces exactly one `<ts>_remote_schema.sql` file.
|
|
|
|
By default the emitted SQL is formatted with the same settings the declarative export uses (uppercase keywords, wrapped at a max width of 180, indented and column-aligned). Configure overrides with `[experimental.pgdelta] format_options` in `config.toml`, or set `format_options = "null"` to opt out and emit raw, unformatted statements.
|
|
|
|
pg-delta is the default diff engine: the migration-file `db pull` workflow uses pg-delta for the shadow diff step unless configured otherwise; it does not switch to declarative output. With pg-delta, `[db.migrations] schema_paths` does not affect this workflow (migra still reads it, for local targets only); use `supabase db schema declarative sync` for declarative schema files. To fall back to the legacy migra engine, set `enabled = false` under `[experimental.pgdelta]` in `config.toml`, or pass `--diff-engine migra` for a single run.
|
|
|
|
When pulling with `--remote=<url>`, prefer a direct connection (`db.<project-ref>.supabase.co:5432`) over the connection pooler so pg-delta can introspect the full catalog reliably.
|
|
|
|
Under the pg-delta engine, a plain `db pull` captures your own customizations in Supabase-managed schemas: triggers on managed tables whose function lives outside the managed schemas (for example a trigger on `auth.users` calling a function in `public`), RLS policies on any `auth` table, and RLS policies on `storage.objects`, `storage.buckets`, and `realtime.messages`. Other objects you create inside managed schemas, such as your own functions or indexes, are not diffed. On later pulls, `--schema` restricts the diff to the listed schemas, so a customization in `auth` is only captured when `auth` is listed or `--schema` is omitted; the initial pull ignores `--schema`.
|
|
|
|
Under the legacy migra engine, the initial pull's `pg_dump` skips the managed schemas, and the migra diff pass that follows appends your trigger and RLS policy changes there to the same migration file. If an older CLI reports that `auth` and `storage` were excluded, capture existing customizations there with `--schema auth,storage`.
|
|
|
|
## Debugging empty pg-delta pulls
|
|
|
|
If `db pull` reports `No schema changes found` but you expect schema output, set `PGDELTA_DEBUG=1` before running the command. Unlike `--debug`, this keeps SSL enabled for hosted Supabase connections.
|
|
|
|
```sh
|
|
PGDELTA_DEBUG=1 supabase db pull --remote="$DATABASE_URL"
|
|
```
|
|
|
|
When pg-delta returns zero statements, the CLI writes a debug bundle under `supabase/.temp/pgdelta/v2/debug/<timestamp>-diff/` containing the source/desired catalog snapshots, the plan, and coverage diagnostics. Catalog files are not written during normal `db pull` runs.
|
|
|
|
For TLS tracing without disabling SSL, use `SUPABASE_SSL_DEBUG=true` alongside `PGDELTA_DEBUG=1`.
|
|
examples:
|
|
- id: basic-usage
|
|
name: Basic usage
|
|
code: supabase db pull --remote
|
|
response: |
|
|
Target: project My Project (abcdefghijklmnopqrst) · production
|
|
◇ Update the remote migration history table on project My Project (abcdefghijklmnopqrst) · production?
|
|
│ Yes
|
|
Schema written to supabase/migrations/20240414044403_remote_schema.sql
|
|
Repaired migration history: [20240414044403] => applied
|
|
Finished supabase db pull.
|
|
- id: local-studio
|
|
name: Local studio
|
|
code: supabase db pull
|
|
response: |
|
|
Target: local stack (127.0.0.1:54322)
|
|
Creating shadow database...
|
|
Seeding globals from roles.sql...
|
|
Applying migration 20240414044403_remote_schema.sql...
|
|
Diffing schemas...
|
|
No schema changes found
|
|
The remote database is already in sync with your local migrations — nothing to pull.
|
|
- id: custom-schemas
|
|
name: Custom schemas
|
|
code: supabase db pull --schema public,extensions --remote
|
|
response: |
|
|
Target: project My Project (abcdefghijklmnopqrst) · production
|
|
Creating shadow database...
|
|
Seeding globals from roles.sql...
|
|
Applying migration 20240414044403_remote_schema.sql...
|
|
Diffing schemas: public,extensions
|
|
No schema changes found
|
|
The remote database is already in sync with your local migrations — nothing to pull.
|
|
tags: []
|
|
links: []
|
|
usage: supabase db pull [migration name] [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: declarative
|
|
name: --declarative
|
|
description: Replace the declarative schema files with the schema of the selected database instead of creating a migration.
|
|
default_value: 'false'
|
|
- id: diff-engine
|
|
name: --diff-engine <[ migra | pg-delta ]>
|
|
description: Diff engine to use when creating a migration.
|
|
default_value: pg-delta
|
|
accepted_values:
|
|
- id: migra
|
|
name: migra
|
|
type: '[ migra | pg-delta ]'
|
|
- id: pg-delta
|
|
name: pg-delta
|
|
type: '[ migra | pg-delta ]'
|
|
- id: password
|
|
name: -p, --password <string>
|
|
description: Database password for the project selected with --remote; ignored for the local database and database URLs.
|
|
default_value: ''
|
|
- id: remote
|
|
name: --remote[=<ref|branch|url>]
|
|
description: 'Target a remote database: the linked project, or --remote=<ref|branch|url>.'
|
|
default_value: 'false'
|
|
- id: schema
|
|
name: -s, --schema <strings>
|
|
description: Comma-separated list of schemas to include.
|
|
default_value: '[]'
|
|
- id: strict-coverage
|
|
name: --strict-coverage
|
|
description: Fail when pg-delta finds schema objects it cannot manage, instead of leaving them unmanaged.
|
|
default_value: 'false'
|
|
breaking_changes:
|
|
- id: target-flags-default
|
|
major: 3
|
|
summary: Bare `db push` / `db pull` now target the local database instead of the linked project; pass `--remote` to reach the linked project.
|
|
direction: upcoming
|
|
flags:
|
|
- --remote
|
|
- --linked
|
|
migration_url: /docs/reference/cli/v3/migrating-from-v2#target-flags-default
|
|
- id: supabase-db-push
|
|
title: supabase db push
|
|
summary: Push new migrations to a database
|
|
description: |
|
|
Apply the local migrations that a database has not run yet. Use it to deploy schema changes to a linked project or another database.
|
|
|
|
It pushes to the local database by default. Pass `--remote` to push to the linked project, which requires your local project to be linked by running `supabase link`. Pass `--remote=<ref|branch|url>` to push to another project, a branch of the linked project, or a database URL such as a self-hosted database.
|
|
|
|
In a linked checkout, a run without `--remote` prints a hint naming the linked project. The command prints a `Target:` line on stderr naming the database it resolved.
|
|
|
|
`--linked`, `--project-ref`, `--db-url` and `--local` still work in v3 but are deprecated and removed in v4; use `--remote`.
|
|
|
|
Before changing a hosted database, the command lists what it will do (migrations, custom roles, seed files and vault secrets) and asks once for confirmation, defaulting to No. Pass `--yes` to confirm without a prompt; JSON output, piped input and agent runs need it. A `SUPABASE_YES` set in `supabase/.env` does not confirm, but one set in your shell does.
|
|
|
|
The first run creates a migration history table at `supabase_migrations.schema_migrations`. After each migration is applied, a row with its timestamp as the unique id is added to the table, so later pushes skip migrations that were already applied.
|
|
|
|
To change the migration history table without running migrations, such as deleting entries or inserting new ones, use the `migration repair` command. Use `--dry-run` to see the list of changes before applying them.
|
|
examples:
|
|
- id: basic-usage
|
|
name: Basic usage
|
|
code: supabase db push --remote
|
|
response: |
|
|
Remote database is up to date.
|
|
- id: self-hosted
|
|
name: Self hosted
|
|
code: supabase db push --remote="postgres://user:pass@db.example.com:5432/postgres"
|
|
response: |
|
|
Pushing migration 20230410135622_create_employees_table.sql...
|
|
Finished supabase db push.
|
|
- id: dry-run
|
|
name: Dry run
|
|
code: supabase db push --dry-run --remote
|
|
response: |
|
|
DRY RUN: migrations will *not* be pushed to the database.
|
|
Would push migration 20230410135622_create_employees_table.sql...
|
|
Would push migration 20230425064254_my_table.sql...
|
|
Finished supabase db push.
|
|
tags: []
|
|
links: []
|
|
usage: supabase db push [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: dry-run
|
|
name: --dry-run
|
|
description: Print the migrations that would be applied, without applying them.
|
|
default_value: 'false'
|
|
- id: include-all
|
|
name: --include-all
|
|
description: Include all migrations not found in the migration history table.
|
|
default_value: 'false'
|
|
- id: include-roles
|
|
name: --include-roles
|
|
description: Include custom roles from supabase/roles.sql.
|
|
default_value: 'false'
|
|
- id: include-seed
|
|
name: --include-seed
|
|
description: Include seed data from your config.
|
|
default_value: 'false'
|
|
- id: password
|
|
name: -p, --password <string>
|
|
description: Database password for the project selected with --remote; ignored for the local database and database URLs.
|
|
default_value: ''
|
|
- id: remote
|
|
name: --remote[=<ref|branch|url>]
|
|
description: 'Target a remote database: the linked project, or --remote=<ref|branch|url>.'
|
|
default_value: 'false'
|
|
- id: skip-vault
|
|
name: --skip-vault
|
|
description: Skip updating vault secrets from the project config file.
|
|
default_value: 'false'
|
|
breaking_changes:
|
|
- id: target-flags-default
|
|
major: 3
|
|
summary: Bare `db push` / `db pull` now target the local database instead of the linked project; pass `--remote` to reach the linked project.
|
|
direction: upcoming
|
|
flags:
|
|
- --remote
|
|
- --linked
|
|
migration_url: /docs/reference/cli/v3/migrating-from-v2#target-flags-default
|
|
- id: supabase-db-query
|
|
title: supabase db query
|
|
summary: Run a SQL query against a database
|
|
description: |
|
|
|
|
|
|
Run a SQL statement against a database and print the result. Pass the statement as an argument or read it from a file with `--file`.
|
|
|
|
It runs against the local database by default. Pass `--remote` for the linked project, or `--remote=<ref|branch|url>` for another project, a branch of the linked project, or a database URL. The command prints a `Target:` line on stderr naming the database it resolved.
|
|
|
|
`--linked`, `--project-ref`, `--db-url` and `--local` still work in v3 but are deprecated and removed in v4; use `--remote`.
|
|
|
|
The command cannot tell a read from a write, so a hosted database (the linked project or a remote database URL) asks for one confirmation (default No) before the statement is sent. Piped answers are never read, so a script, a JSON run or an agent must pass `--yes` or set `SUPABASE_YES` in the shell. A `SUPABASE_YES` in `supabase/.env` does not count.
|
|
|
|
The local database never asks.
|
|
|
|
## Read-only mode
|
|
|
|
Pass `--read-only` to run a statement that must not change anything. It skips the confirmation on a hosted database.
|
|
|
|
Before the statement is sent or any question is asked, every statement must start with `SELECT`, `WITH`, `VALUES`, `TABLE`, `SHOW`, `EXPLAIN` or a parenthesised query, after whitespace and comments. Any other statement (`COMMIT`, `SET`, `CALL`, `DO`, `COPY`, `LOCK` and so on) is rejected, as is input that ends inside a comment, quote or dollar quote, and input that contains a `BEGIN ATOMIC` function body. The words `begin atomic` inside a string, quoted identifier, dollar quote or comment, as in `select 'begin atomic'`, are allowed.
|
|
|
|
Drop `--read-only` to run one of the rejected statements.
|
|
|
|
The local database or a database URL runs the statement in a read-only transaction that is always rolled back, with a 5 second `lock_timeout` so the read cannot wait on heavy locks. Postgres rejects writes inside it. A linked project runs it through the Management API's `read_only` mode, and the API enforces it.
|
|
|
|
`--read-only` does not stop a read statement from calling a function that has side effects, such as `pg_terminate_backend` or `dblink_exec`. Those still run.
|
|
|
|
## Output format
|
|
|
|
When an AI coding agent runs the command (auto-detected or via `--agent=yes`), the default output format is JSON with an untrusted data warning envelope. When a human runs it (`--agent=no` or no agent detected), the default output format is a table without the envelope.
|
|
examples:
|
|
- id: example-1
|
|
name: Run a query against the local database
|
|
code: supabase db query "select count(*) from auth.users"
|
|
- id: example-2
|
|
name: Run a read-only query against the linked project
|
|
code: supabase db query --remote --read-only "select now()"
|
|
- id: example-3
|
|
name: Run the statements in a SQL file
|
|
code: supabase db query --file ./report.sql
|
|
tags: []
|
|
links: []
|
|
usage: supabase db query [sql] [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: file
|
|
name: -f, --file <string>
|
|
description: Path to a SQL file to execute.
|
|
default_value: ''
|
|
- id: output
|
|
name: -o, --output <[ json | table | csv ]>
|
|
description: 'Output format: table, json, or csv.'
|
|
default_value: json
|
|
accepted_values:
|
|
- id: json
|
|
name: json
|
|
type: '[ json | table | csv ]'
|
|
- id: table
|
|
name: table
|
|
type: '[ json | table | csv ]'
|
|
- id: csv
|
|
name: csv
|
|
type: '[ json | table | csv ]'
|
|
- id: read-only
|
|
name: --read-only
|
|
description: Run the statement in a read-only transaction; a hosted target needs no confirmation.
|
|
default_value: 'false'
|
|
- id: remote
|
|
name: --remote[=<ref|branch|url>]
|
|
description: 'Target a remote database: the linked project, or --remote=<ref|branch|url>.'
|
|
default_value: 'false'
|
|
- id: supabase-db-reset
|
|
title: supabase db reset
|
|
summary: Reset a database to the current migrations
|
|
description: |
|
|
|
|
|
|
Recreate a database from your local migrations and seed it, discarding any other data or schema changes. Use it to get a clean database during development.
|
|
|
|
It resets the local database by default, which requires the local development stack to be started by running `supabase start`. The command recreates the local Postgres container and applies all migrations in `supabase/migrations`. If test data is defined in `supabase/seed.sql`, it is seeded afterwards.
|
|
|
|
Pass `--remote` to reset the linked project, or `--remote=<ref|branch|url>` to reset another project, a branch of the linked project, or a database URL. The command prints a `Target:` line on stderr naming the database it resolved.
|
|
|
|
`--linked`, `--project-ref`, `--db-url` and `--local` still work in v3 but are deprecated and removed in v4; use `--remote`.
|
|
|
|
## Seeding
|
|
|
|
Use `--no-seed` to skip seeding entirely. To override `[db.seed].sql_paths` for a single reset, pass one or more `--sql-paths` flags, which accept the same file paths and glob patterns as `sql_paths`, relative to the `supabase` directory. Passing `--sql-paths` enables seeding for that reset even when `[db.seed].enabled = false`.
|
|
|
|
If you combine `--sql-paths` with `--remote`, the override seed files are applied to the selected remote database after migrations. Use this only when you intend to seed that remote target.
|
|
|
|
## Resetting a remote database
|
|
|
|
A remote reset runs a SQL script that drops all user-created entities in the database. Postgres roles are cluster-level entities, so custom roles created through the dashboard or `supabase/roles.sql` are not deleted.
|
|
|
|
The command asks for one confirmation (default No) after it has worked out what it will do and before anything is dropped. The question lists dropping every user schema, any vault secrets it will upsert, the migrations or schema files it will apply, and the seed files it will run. Declining stops the command without changing the database.
|
|
|
|
Piped answers are never read, so a script, a JSON run or an agent must pass `--yes` or set `SUPABASE_YES` in the shell. A `SUPABASE_YES` in `supabase/.env` does not count. The local database never asks.
|
|
examples:
|
|
- id: basic-usage
|
|
name: Basic usage
|
|
code: supabase db reset
|
|
response: |
|
|
Resetting database...
|
|
Initializing schema...
|
|
Applying migration 20220810154537_create_employees_table.sql...
|
|
Seeding data supabase/seed.sql...
|
|
Finished supabase db reset on branch main.
|
|
tags: []
|
|
links: []
|
|
usage: supabase db reset [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: last
|
|
name: --last <int>
|
|
description: Reset up to the last n migration versions.
|
|
default_value: '0'
|
|
- id: no-seed
|
|
name: --no-seed
|
|
description: Skip running the seed script after reset.
|
|
default_value: 'false'
|
|
- id: remote
|
|
name: --remote[=<ref|branch|url>]
|
|
description: 'Target a remote database: the linked project, or --remote=<ref|branch|url>.'
|
|
default_value: 'false'
|
|
- id: sql-paths
|
|
name: --sql-paths <strings>
|
|
description: Override [db.seed].sql_paths for this reset with SQL file paths or glob patterns relative to the supabase directory, which also enables seeding.
|
|
default_value: '[]'
|
|
- id: version
|
|
name: --version <string>
|
|
description: Reset up to the specified migration version.
|
|
default_value: ''
|
|
- id: supabase-db-schema
|
|
title: supabase db schema
|
|
summary: Manage database schema
|
|
description: Work with your database schema as declarative SQL files instead of hand-written migrations.
|
|
tags: []
|
|
links: []
|
|
subcommands:
|
|
- supabase-db-schema-declarative
|
|
flags: []
|
|
- id: supabase-db-schema-declarative
|
|
title: supabase db schema declarative
|
|
summary: Manage declarative database schemas
|
|
description: Keep your schema as a tree of SQL files and generate migrations from the difference to your applied migrations.
|
|
tags: []
|
|
links: []
|
|
subcommands:
|
|
- supabase-db-schema-declarative-generate
|
|
- supabase-db-schema-declarative-sync
|
|
flags: []
|
|
- id: supabase-db-schema-declarative-generate
|
|
title: supabase db schema declarative generate
|
|
summary: Generate declarative schema from a database
|
|
description: |
|
|
|
|
|
|
Export the schema of a live database as SQL files in the declarative schema directory. This is the entry point for bootstrapping declarative mode.
|
|
|
|
The database is the local one unless you pass `--remote` for the linked project, or `--remote=<ref|branch|url>` for another project, a branch of the linked project, or a database URL. The command never asks which database to use. With the local database, `--reset` recreates it from your migrations first.
|
|
|
|
When the destination already holds files, the command asks before overwriting them. Pass `--overwrite` or `--yes` to skip the question.
|
|
|
|
`--linked`, `--project-ref`, `--db-url` and `--local` still work in v3 but are deprecated and removed in v4; use `--remote`.
|
|
|
|
## Output layout
|
|
|
|
The bundled pg-delta engine writes one directory per schema at the root of the declarative directory, such as `supabase/schemas/public/tables/users.sql` and `supabase/schemas/public/schema.sql`. Cluster-level objects that belong to no schema go under a reserved `_cluster/` directory, such as `supabase/schemas/_cluster/roles.sql`.
|
|
|
|
When platform default grants (`anon`, `authenticated`, `service_role`) need an overlay `REVOKE ALL`, the export writes `adp_wipes.sql` after `schema.sql` in that schema, or `_cluster/adp_wipes.sql` for cluster-wide overlays. This keeps privileges that were revoked in the source when you load the files onto a fresh project.
|
|
|
|
A schema named `_cluster` or `_custom`, in any casing, has its leading underscore percent-encoded (`%5Fcluster/`) so it never claims a directory the export owns. Put hand-written SQL that pg-delta does not model in `_custom/`, which the export never writes to or prunes.
|
|
|
|
## Formatting
|
|
|
|
Emitted SQL uses the same default format as `db pull`: uppercase keywords, indent 2, width 180, and column alignment. Override it with `[experimental.pgdelta] format_options`, or set `format_options = "null"` for raw statements.
|
|
|
|
This command is enabled by default. When `[experimental.pgdelta] enabled = false` is set in config, pass `--experimental` to run it.
|
|
examples:
|
|
- id: example-1
|
|
name: Export the local database as declarative schema files
|
|
code: supabase db schema declarative generate
|
|
- id: example-2
|
|
name: Replace the declarative files with the schema of the linked project
|
|
code: supabase db schema declarative generate --remote --overwrite
|
|
tags: []
|
|
links: []
|
|
usage: supabase db schema declarative generate [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: output-dir
|
|
name: --output-dir <string>
|
|
description: Write the generated declarative schema to this directory instead of the configured declarative schema path.
|
|
default_value: ''
|
|
- id: overwrite
|
|
name: --overwrite
|
|
description: Overwrite existing declarative schema files without asking.
|
|
default_value: 'false'
|
|
- id: password
|
|
name: -p, --password <string>
|
|
description: Database password for the project selected with --remote; ignored for the local database and database URLs.
|
|
default_value: ''
|
|
- id: remote
|
|
name: --remote[=<ref|branch|url>]
|
|
description: 'Target a remote database: the linked project, or --remote=<ref|branch|url>.'
|
|
default_value: 'false'
|
|
- id: reset
|
|
name: --reset
|
|
description: Reset the local database from your migrations before generating, which discards local data.
|
|
default_value: 'false'
|
|
- id: schema
|
|
name: -s, --schema <strings>
|
|
description: Comma-separated list of schemas to include.
|
|
default_value: '[]'
|
|
- id: experimental
|
|
name: --experimental
|
|
description: enable experimental features
|
|
default_value: 'false'
|
|
- id: no-cache
|
|
name: --no-cache
|
|
description: Disable the catalog cache and force a fresh shadow database setup.
|
|
default_value: 'false'
|
|
- id: strict-coverage
|
|
name: --strict-coverage
|
|
description: Fail when pg-delta finds schema objects it cannot manage, instead of leaving them unmanaged.
|
|
default_value: 'false'
|
|
- id: supabase-db-schema-declarative-sync
|
|
title: supabase db schema declarative sync
|
|
summary: Generate a migration from declarative schema
|
|
description: |
|
|
|
|
|
|
Turn the changes you made in your declarative schema files into a new migration. It diffs the files against the current migration state.
|
|
|
|
When no declarative schema exists yet, the command offers to run `generate` first, exporting from the local database. To start from a linked project or a database URL, run `generate --remote` or `generate --remote=<url>` yourself first.
|
|
|
|
After computing the diff, you can optionally name the migration and apply it to the local database. This command is enabled by default. When `[experimental.pgdelta] enabled = false` is set in config, pass `--experimental` to run it.
|
|
examples:
|
|
- id: with-pg-delta
|
|
name: Sync declarative schema with pg-delta
|
|
code: |
|
|
# After editing declarative schema files, generate a migration:
|
|
supabase db schema declarative sync --experimental
|
|
response: |
|
|
Creating shadow database...
|
|
Applying declarative schemas via pg-delta...
|
|
Applied 239 statements in 1 round(s).
|
|
Enter a name for this migration (press Enter to keep 'declarative_sync'): add_updated_at
|
|
Created new migration at supabase/migrations/20260317194051_add_updated_at.sql
|
|
Apply this migration to local database? [Y/n]
|
|
Target: local stack (127.0.0.1:54322)
|
|
Applying migration 20260317194051_add_updated_at.sql...
|
|
Migration applied successfully.
|
|
- id: generate-first
|
|
name: Generate declarative schema from migrations
|
|
code: |
|
|
supabase db schema declarative sync --experimental
|
|
response: |
|
|
No declarative schema found. Generate a new one ? [Y/n]
|
|
Reset local database to match migrations first? (local data will be lost) [y/N] y
|
|
Resetting database...
|
|
...
|
|
Declarative schema written to supabase/schemas
|
|
Finished supabase db schema declarative generate.
|
|
tags: []
|
|
links: []
|
|
usage: supabase db schema declarative sync [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: apply
|
|
name: --apply
|
|
description: Apply the new migration to the local database without asking.
|
|
default_value: 'false'
|
|
- id: file
|
|
name: -f, --file <string>
|
|
description: Name for the new migration file, used when --name is not set.
|
|
default_value: declarative_sync
|
|
- id: name
|
|
name: --name <string>
|
|
description: Name for the new migration file.
|
|
default_value: ''
|
|
- id: no-apply
|
|
name: --no-apply
|
|
description: Write the migration file without asking and without applying it to the local database.
|
|
default_value: 'false'
|
|
- id: schema
|
|
name: -s, --schema <strings>
|
|
description: Comma-separated list of schemas to include.
|
|
default_value: '[]'
|
|
- id: experimental
|
|
name: --experimental
|
|
description: enable experimental features
|
|
default_value: 'false'
|
|
- id: no-cache
|
|
name: --no-cache
|
|
description: Disable the catalog cache and force a fresh shadow database setup.
|
|
default_value: 'false'
|
|
- id: strict-coverage
|
|
name: --strict-coverage
|
|
description: Fail when pg-delta finds schema objects it cannot manage, instead of leaving them unmanaged.
|
|
default_value: 'false'
|
|
- id: supabase-db-start
|
|
title: supabase db start
|
|
summary: Start the local Postgres database
|
|
description: Start only the local Postgres container, without the rest of the Supabase stack. Use it when you just need a local database, for example to run migrations.
|
|
examples:
|
|
- id: example-1
|
|
name: Start the local Postgres database
|
|
code: supabase db start
|
|
- id: example-2
|
|
name: Start the database and restore it from a logical backup
|
|
code: supabase db start --from-backup ./backup.sql
|
|
tags: []
|
|
links: []
|
|
usage: supabase db start [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: from-backup
|
|
name: --from-backup <string>
|
|
description: Path to a logical backup file to restore from.
|
|
default_value: ''
|
|
- id: supabase-domains
|
|
title: supabase domains
|
|
summary: Manage custom domain names for Supabase projects
|
|
description: Serve your project on your own domain name instead of the Supabase-provisioned subdomain. Custom domains and vanity subdomains are mutually exclusive.
|
|
tags:
|
|
- management-api
|
|
links: []
|
|
subcommands:
|
|
- supabase-domains-activate
|
|
- supabase-domains-create
|
|
- supabase-domains-delete
|
|
- supabase-domains-get
|
|
- supabase-domains-reverify
|
|
flags: []
|
|
- id: supabase-domains-activate
|
|
title: supabase domains activate
|
|
summary: Activate the custom hostname for a project
|
|
description: |
|
|
|
|
|
|
Makes your project respond to requests on its custom hostname. Use it once your hostname is set up and you are ready to switch over from the Supabase-provisioned subdomain.
|
|
|
|
After the custom hostname is activated, your project's third-party auth providers will no longer function on the Supabase-provisioned subdomain. See [Prepare to activate your domain](/docs/guides/platform/custom-domains#prepare-to-activate-your-domain) for the steps to follow first.
|
|
|
|
It asks for confirmation before activating, with a default of No. Pass `--yes` (or set `SUPABASE_YES` in the shell) to run without a prompt, which JSON output and non-interactive runs require.
|
|
examples:
|
|
- id: example-1
|
|
name: Activate the custom hostname for a project
|
|
code: supabase domains activate --remote=abcdefghijklmnopqrst
|
|
tags: []
|
|
links: []
|
|
usage: supabase domains activate [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: supabase-domains-create
|
|
title: supabase domains create
|
|
summary: Create a custom hostname
|
|
description: Starts custom domain setup for your project. Before you run it, add a CNAME record from your hostname to your project's Supabase subdomain. Then run `supabase domains reverify` until verification completes, and `supabase domains activate` to switch over.
|
|
examples:
|
|
- id: example-1
|
|
name: Create a custom hostname for a project
|
|
code: supabase domains create --custom-hostname example.com --remote=abcdefghijklmnopqrst
|
|
tags: []
|
|
links: []
|
|
usage: supabase domains create [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: custom-hostname
|
|
name: --custom-hostname <string>
|
|
description: The custom hostname to use for the project.
|
|
required: true
|
|
default_value: ''
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: supabase-domains-delete
|
|
title: supabase domains delete
|
|
summary: Delete the custom hostname config
|
|
description: Removes the custom hostname configuration so the project is served only on its Supabase-provisioned domain. Use it to start over, or to move to a vanity subdomain.
|
|
examples:
|
|
- id: example-1
|
|
name: Delete the custom hostname config for a project
|
|
code: supabase domains delete --remote=abcdefghijklmnopqrst
|
|
tags: []
|
|
links: []
|
|
usage: supabase domains delete [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: supabase-domains-get
|
|
title: supabase domains get
|
|
summary: Get the current custom hostname config
|
|
description: Checks where custom domain setup stands for your project, including any DNS records you still need to add.
|
|
examples:
|
|
- id: example-1
|
|
name: Get the custom hostname config for a project
|
|
code: supabase domains get --remote=abcdefghijklmnopqrst
|
|
tags: []
|
|
links: []
|
|
usage: supabase domains get [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: supabase-domains-reverify
|
|
title: supabase domains reverify
|
|
summary: Re-verify the custom hostname config
|
|
description: Asks Supabase to check your DNS records again. Run it after you add or change the CNAME or TXT records for your hostname.
|
|
examples:
|
|
- id: example-1
|
|
name: Re-verify the custom hostname for a project
|
|
code: supabase domains reverify --remote=abcdefghijklmnopqrst
|
|
tags: []
|
|
links: []
|
|
usage: supabase domains reverify [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: supabase-encryption
|
|
title: supabase encryption
|
|
summary: Manage encryption keys
|
|
description: Get or update the root encryption key of a project.
|
|
tags:
|
|
- management-api
|
|
links: []
|
|
subcommands:
|
|
- supabase-encryption-get-root-key
|
|
- supabase-encryption-update-root-key
|
|
flags: []
|
|
- id: supabase-encryption-get-root-key
|
|
title: supabase encryption get-root-key
|
|
summary: Get the root encryption key
|
|
description: Print the root encryption key of the project. Treat the output as a secret.
|
|
examples:
|
|
- id: example-1
|
|
name: Print the root encryption key of the linked project
|
|
code: supabase encryption get-root-key
|
|
tags: []
|
|
links: []
|
|
usage: supabase encryption get-root-key [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: supabase-encryption-update-root-key
|
|
title: supabase encryption update-root-key
|
|
summary: Update the root encryption key
|
|
description: |-
|
|
Replace the root encryption key of the project with a new one. The new key is read from a masked prompt, or from piped stdin when there is no terminal.
|
|
|
|
Asks for confirmation before changing anything; pass `--yes` in scripts and CI.
|
|
examples:
|
|
- id: example-1
|
|
name: Update the root encryption key, entering the new key at the prompt
|
|
code: supabase encryption update-root-key
|
|
- id: example-2
|
|
name: Update the root encryption key from stdin without confirmation
|
|
code: echo "<new-root-key>" | supabase encryption update-root-key --yes
|
|
tags: []
|
|
links: []
|
|
usage: supabase encryption update-root-key [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: supabase-feedback
|
|
title: supabase feedback
|
|
summary: Send or delete CLI feedback
|
|
description: Tell the Supabase team what works and what does not in the CLI, or delete feedback you sent earlier using its deletion token.
|
|
tags:
|
|
- other-commands
|
|
links: []
|
|
subcommands:
|
|
- supabase-feedback-add
|
|
- supabase-feedback-delete
|
|
flags: []
|
|
- id: supabase-feedback-add
|
|
title: supabase feedback add
|
|
summary: Send feedback to the Supabase team
|
|
description: Send a short note about a papercut, bug, or idea. The CLI prints a deletion token you can use to remove the feedback later.
|
|
examples:
|
|
- id: example-1
|
|
name: Send quick feedback about a papercut in one line
|
|
code: supabase feedback add "when I run multiple stacks in parallel I get port conflicts"
|
|
- id: example-2
|
|
name: Use -- when the message starts with a dash
|
|
code: supabase feedback add -- "--yes should be the default in CI"
|
|
- id: example-3
|
|
name: Attribute the feedback to a project from an unlinked directory
|
|
code: supabase feedback add --project-ref abcdefghijklmnopqrst "branching is slow here"
|
|
tags: []
|
|
links: []
|
|
usage: supabase feedback add [message] ... [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: project-ref
|
|
name: --project-ref <string>
|
|
description: Project ref to attribute the feedback to (defaults to SUPABASE_PROJECT_ID, then the linked project).
|
|
default_value: ''
|
|
- id: supabase-feedback-delete
|
|
title: supabase feedback delete
|
|
summary: Delete submitted feedback
|
|
description: Remove feedback you sent earlier. Use the deletion token printed when you submitted it.
|
|
examples:
|
|
- id: example-1
|
|
name: Delete feedback using the token printed when it was submitted
|
|
code: supabase feedback delete 123e4567-e89b-12d3-a456-426614174000
|
|
tags: []
|
|
links: []
|
|
usage: supabase feedback delete <token> [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: project-ref
|
|
name: --project-ref <string>
|
|
description: Project ref the feedback was submitted with.
|
|
default_value: ''
|
|
- id: supabase-functions
|
|
title: supabase functions
|
|
summary: Manage Edge Functions
|
|
description: |
|
|
|
|
|
|
Create, serve, deploy and delete Edge Functions, the server-side TypeScript functions that run close to your users on a Deno-compatible edge runtime. They suit webhooks, custom API endpoints, data validation and personalized content, without deploying or scaling a traditional server.
|
|
|
|
The runtime needs no package management, starts quickly and is secure by default.
|
|
|
|
Commands that change the hosted project, `functions deploy` (including `--prune`) and `functions delete`, print the `Target:` line and then ask for confirmation before changing anything. The default answer is no. `functions deploy` asks one question covering every function it deploys and every function `--prune` deletes.
|
|
|
|
Piped answers are never read, so scripts, JSON runs and agents must pass `--yes` or set `SUPABASE_YES` in the shell. A `SUPABASE_YES` in `supabase/.env` does not count.
|
|
|
|
`functions list` and `functions download` only read and never ask.
|
|
tags:
|
|
- management-api
|
|
links: []
|
|
subcommands:
|
|
- supabase-functions-delete
|
|
- supabase-functions-deploy
|
|
- supabase-functions-download
|
|
- supabase-functions-list
|
|
- supabase-functions-new
|
|
- supabase-functions-serve
|
|
flags: []
|
|
- id: supabase-functions-delete
|
|
title: supabase functions delete
|
|
summary: Delete an Edge Function from a project
|
|
description: |-
|
|
Delete a deployed Edge Function from the linked project. Your local copy in `supabase/functions` is not removed.
|
|
|
|
Asks for confirmation before changing anything; pass `--yes` in scripts and CI.
|
|
examples:
|
|
- id: example-1
|
|
name: Delete a deployed function from the linked project
|
|
code: supabase functions delete hello-world
|
|
- id: example-2
|
|
name: Delete a deployed function from a specific project
|
|
code: supabase functions delete hello-world --remote=abcdefghijklmnopqrst
|
|
tags: []
|
|
links: []
|
|
usage: supabase functions delete <Function name> [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: supabase-functions-deploy
|
|
title: supabase functions deploy
|
|
summary: Deploy Edge Functions to a project
|
|
description: |-
|
|
Deploy local Edge Functions to the linked project. Deploys every function in `supabase/functions` unless you name specific ones.
|
|
|
|
With `--prune`, functions that exist in the project but not locally are deleted. Asks for confirmation before changing anything; pass `--yes` in scripts and CI.
|
|
examples:
|
|
- id: example-1
|
|
name: Deploy a single function to the linked project
|
|
code: supabase functions deploy hello-world
|
|
- id: example-2
|
|
name: Deploy all local functions to a specific project
|
|
code: supabase functions deploy --remote=abcdefghijklmnopqrst
|
|
tags: []
|
|
links: []
|
|
usage: supabase functions deploy [Function name] ... [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: import-map
|
|
name: --import-map <string>
|
|
description: Path to an import map file.
|
|
default_value: ''
|
|
- id: jobs
|
|
name: -j, --jobs <int>
|
|
description: Maximum number of parallel jobs.
|
|
default_value: '1'
|
|
- id: no-verify-jwt
|
|
name: --no-verify-jwt
|
|
description: Disable JWT verification for the function.
|
|
default_value: 'false'
|
|
- id: prune
|
|
name: --prune
|
|
description: Delete functions that exist in the project but not locally.
|
|
default_value: 'false'
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: use-api
|
|
name: --use-api
|
|
description: Bundle functions server-side without using Docker.
|
|
default_value: 'false'
|
|
- id: supabase-functions-download
|
|
title: supabase functions download
|
|
summary: Download Edge Functions from a project
|
|
description: Download the source code of deployed Edge Functions from the linked project. Downloads every function when you omit the name.
|
|
examples:
|
|
- id: example-1
|
|
name: Download a single function from the linked project
|
|
code: supabase functions download hello-world
|
|
- id: example-2
|
|
name: Download all functions from a specific project
|
|
code: supabase functions download --remote=abcdefghijklmnopqrst
|
|
tags: []
|
|
links: []
|
|
usage: supabase functions download [Function name] [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: use-api
|
|
name: --use-api
|
|
description: Unbundle functions server-side without using Docker.
|
|
default_value: 'false'
|
|
- id: supabase-functions-list
|
|
title: supabase functions list
|
|
summary: List deployed Edge Functions
|
|
description: Show the Edge Functions deployed to the linked project.
|
|
examples:
|
|
- id: example-1
|
|
name: List all deployed functions in the linked project
|
|
code: supabase functions list
|
|
- id: example-2
|
|
name: List all deployed functions in a specific project
|
|
code: supabase functions list --remote=abcdefghijklmnopqrst
|
|
tags: []
|
|
links: []
|
|
usage: supabase functions list [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: supabase-functions-new
|
|
title: supabase functions new
|
|
summary: Create an Edge Function locally
|
|
description: |
|
|
|
|
|
|
Scaffold a starter Edge Function in `supabase/functions/<name>`, ready to edit and serve locally.
|
|
|
|
The function is a new directory with the name you specify, containing an `index.ts` with the Deno imports and a basic function structure.
|
|
|
|
After creating the function, edit it, test it with `supabase functions serve`, then publish it with `supabase functions deploy`.
|
|
examples:
|
|
- id: example-1
|
|
name: Create a new function
|
|
code: supabase functions new my-function
|
|
- id: example-2
|
|
name: Create a function with the user auth mode
|
|
code: supabase functions new my-function --auth user
|
|
tags: []
|
|
links: []
|
|
usage: supabase functions new <Function name> [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: auth
|
|
name: --auth <[ none | apikey | user ]>
|
|
description: Auth mode to scaffold the function with.
|
|
default_value: apikey
|
|
accepted_values:
|
|
- id: none
|
|
name: none
|
|
type: '[ none | apikey | user ]'
|
|
- id: apikey
|
|
name: apikey
|
|
type: '[ none | apikey | user ]'
|
|
- id: user
|
|
name: user
|
|
type: '[ none | apikey | user ]'
|
|
- id: supabase-functions-serve
|
|
title: supabase functions serve
|
|
summary: Serve Edge Functions locally
|
|
description: |
|
|
|
|
|
|
Run all Edge Functions in `supabase/functions` locally, so you can test them before deploying.
|
|
|
|
The command includes flags for debugging through the V8 inspector protocol, which works with Chrome DevTools, VS Code and IntelliJ IDEA. See the [debugging guide](/docs/guides/functions/debugging-tools) for setup instructions.
|
|
|
|
1. `--inspect`
|
|
- Alias of `--inspect-mode brk`.
|
|
|
|
2. `--inspect-mode [ run | brk | wait ]`
|
|
- Activates the inspector.
|
|
- `run` allows a connection without additional behavior. It is not ideal for short scripts, but is useful for long-running scripts where you occasionally want to set breakpoints.
|
|
- `brk` behaves like `run`, and also sets a breakpoint at the first line to pause execution before any code runs.
|
|
- `wait` behaves like `brk`, but pauses execution until an inspector session connects instead of setting a breakpoint.
|
|
|
|
3. `--inspect-main`
|
|
- Can only be used when one of the above two flags is enabled.
|
|
- Creating an inspector session for the main worker is not allowed by default; this flag allows it.
|
|
- Other behavior follows the `inspect-mode` flag.
|
|
|
|
You can also customize the inspector under the `edge_runtime` section of `supabase/config.toml`:
|
|
|
|
1. `inspector_port`
|
|
- The port the inspector session listens on. Defaults to 8083.
|
|
2. `policy`
|
|
- How the edge runtime forwards incoming HTTP requests to the worker.
|
|
- `per_worker` allows multiple requests to be forwarded to a worker that already exists.
|
|
- `oneshot` forces the worker to process a single request and then exit. This is useful when debugging, because your changes take effect immediately.
|
|
examples:
|
|
- id: example-1
|
|
name: Serve all functions locally
|
|
code: supabase functions serve
|
|
- id: example-2
|
|
name: Serve with a custom env file
|
|
code: supabase functions serve --env-file .env.local
|
|
- id: example-3
|
|
name: Serve with the inspector paused at the first line
|
|
code: supabase functions serve --inspect-mode brk
|
|
tags: []
|
|
links: []
|
|
usage: supabase functions serve [Function name] ... [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: env-file
|
|
name: --env-file <string>
|
|
description: Path to an env file that overrides `supabase/functions/.env` and per-function `.env` files.
|
|
default_value: ''
|
|
- id: import-map
|
|
name: --import-map <string>
|
|
description: Path to an import map file.
|
|
default_value: ''
|
|
- id: inspect
|
|
name: --inspect
|
|
description: Alias of `--inspect-mode brk`.
|
|
default_value: 'false'
|
|
- id: inspect-main
|
|
name: --inspect-main
|
|
description: Allow inspecting the main worker; requires an inspect flag.
|
|
default_value: 'false'
|
|
- id: inspect-mode
|
|
name: --inspect-mode <[ run | brk | wait ]>
|
|
description: Activate the inspector in the given mode for debugging.
|
|
default_value: ''
|
|
accepted_values:
|
|
- id: run
|
|
name: run
|
|
type: '[ run | brk | wait ]'
|
|
- id: brk
|
|
name: brk
|
|
type: '[ run | brk | wait ]'
|
|
- id: wait
|
|
name: wait
|
|
type: '[ run | brk | wait ]'
|
|
- id: no-verify-jwt
|
|
name: --no-verify-jwt
|
|
description: Disable JWT verification for the functions.
|
|
default_value: 'false'
|
|
- id: supabase-gen
|
|
title: supabase gen
|
|
summary: Generate types, keys and tokens
|
|
description: |
|
|
|
|
|
|
Generate typed definitions from your database schema, plus JWT signing keys and Bearer tokens for local development.
|
|
|
|
Use `gen types` to get type safety and autocompletion in your application code. Use `gen signing-key` and `gen bearer-jwt` to create the keys and tokens that the local stack and the Data API accept.
|
|
tags:
|
|
- local-dev
|
|
links: []
|
|
subcommands:
|
|
- supabase-gen-bearer-jwt
|
|
- supabase-gen-signing-key
|
|
- supabase-gen-types
|
|
flags: []
|
|
- id: supabase-gen-bearer-jwt
|
|
title: supabase gen bearer-jwt
|
|
summary: Generate a Bearer Auth JWT for the Data API
|
|
description: |-
|
|
Create a signed JWT for a Postgres role, for calling the Data API. The token is signed locally with a JWT signing key.
|
|
|
|
Set the claims with `--sub` and `--payload`, and the lifetime with `--valid-for` or `--exp`.
|
|
examples:
|
|
- id: example-1
|
|
name: Generate a token for an authenticated user
|
|
code: supabase gen bearer-jwt --role authenticated --sub <user-id>
|
|
- id: example-2
|
|
name: Generate a service role token valid for one hour
|
|
code: supabase gen bearer-jwt --role service_role --valid-for 1h
|
|
tags: []
|
|
links: []
|
|
usage: supabase gen bearer-jwt [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: exp
|
|
name: --exp <string>
|
|
description: Expiry timestamp of the token.
|
|
default_value: ''
|
|
- id: payload
|
|
name: --payload <string>
|
|
description: Custom claims to add, as a JSON object.
|
|
default_value: '{}'
|
|
- id: role
|
|
name: --role <string>
|
|
description: Postgres role the token acts as.
|
|
required: true
|
|
default_value: ''
|
|
- id: sub
|
|
name: --sub <string>
|
|
description: User ID to impersonate, set as the `sub` claim.
|
|
default_value: anonymous
|
|
- id: valid-for
|
|
name: --valid-for <string>
|
|
description: How long the token stays valid, such as `30m`.
|
|
default_value: 30m0s
|
|
- id: supabase-gen-signing-key
|
|
title: supabase gen signing-key
|
|
summary: Generate a JWT signing key
|
|
description: |-
|
|
Generate a private JWT signing key to use in the CLI or to import in the dashboard.
|
|
|
|
Supported algorithms:
|
|
ES256 - ECDSA with P-256 curve and SHA-256 (recommended)
|
|
RS256 - RSA with SHA-256
|
|
examples:
|
|
- id: example-1
|
|
name: Generate an ES256 signing key and print it to stdout
|
|
code: supabase gen signing-key
|
|
- id: example-2
|
|
name: Generate an RSA signing key
|
|
code: supabase gen signing-key --algorithm RS256
|
|
- id: example-3
|
|
name: Append a new key to the configured signing key file
|
|
code: supabase gen signing-key --append
|
|
tags: []
|
|
links: []
|
|
usage: supabase gen signing-key [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: algorithm
|
|
name: --algorithm <[ ES256 | RS256 ]>
|
|
description: Algorithm to generate the signing key with.
|
|
default_value: ES256
|
|
accepted_values:
|
|
- id: ES256
|
|
name: ES256
|
|
type: '[ ES256 | RS256 ]'
|
|
- id: RS256
|
|
name: RS256
|
|
type: '[ ES256 | RS256 ]'
|
|
- id: append
|
|
name: --append
|
|
description: Append the new key to the existing keys file instead of overwriting it.
|
|
default_value: 'false'
|
|
- id: supabase-gen-types
|
|
title: supabase gen types
|
|
summary: Generate types from Postgres schema
|
|
description: |
|
|
|
|
|
|
Generate typed definitions for the tables, views and stored procedures in your Postgres schema, so your code gets type safety and autocompletion. TypeScript is the default output; Go and Swift are also supported.
|
|
|
|
By default the command reads the local database. Pass `--remote` for the linked project, or `--remote=<ref|branch|url>` for another project, a branch of the linked project, or a database URL.
|
|
|
|
The types respect the relationships, constraints and custom types defined in your schema.
|
|
|
|
`--linked`, `--project-ref`, `--db-url` and `--local` still work in v3 but are deprecated and removed in v4; use `--remote`. `--project-id` is also deprecated; use `--remote=<ref>`.
|
|
examples:
|
|
- id: example-1
|
|
name: Generate types from the local dev database
|
|
code: supabase gen types
|
|
- id: example-2
|
|
name: Generate Go types from the linked project
|
|
code: supabase gen types --lang=go --remote
|
|
- id: example-3
|
|
name: Generate types from a project ref with specific schemas
|
|
code: supabase gen types --schema public --schema private --remote=abcdefghijklmnopqrst
|
|
- id: example-4
|
|
name: Generate types from a database URL
|
|
code: supabase gen types --schema public --schema auth --remote='postgresql://...'
|
|
tags: []
|
|
links: []
|
|
usage: supabase gen types [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: lang
|
|
name: --lang <[ typescript | go | python | swift | dart ]>
|
|
description: Output language of the generated types.
|
|
default_value: typescript
|
|
accepted_values:
|
|
- id: typescript
|
|
name: typescript
|
|
type: '[ typescript | go | python | swift | dart ]'
|
|
- id: go
|
|
name: go
|
|
type: '[ typescript | go | python | swift | dart ]'
|
|
- id: python
|
|
name: python
|
|
type: '[ typescript | go | python | swift | dart ]'
|
|
- id: swift
|
|
name: swift
|
|
type: '[ typescript | go | python | swift | dart ]'
|
|
- id: dart
|
|
name: dart
|
|
type: '[ typescript | go | python | swift | dart ]'
|
|
- id: query-timeout
|
|
name: --query-timeout <string>
|
|
description: Maximum timeout allowed for the database query.
|
|
default_value: 15s
|
|
- id: remote
|
|
name: --remote[=<ref|branch|url>]
|
|
description: 'Target a remote database: the linked project, or --remote=<ref|branch|url>.'
|
|
default_value: 'false'
|
|
- id: schema
|
|
name: -s, --schema <strings>
|
|
description: Comma-separated list of schemas to include.
|
|
default_value: '[]'
|
|
- id: swift-access-control
|
|
name: --swift-access-control <[ internal | public ]>
|
|
description: Access control for Swift generated types.
|
|
default_value: internal
|
|
accepted_values:
|
|
- id: internal
|
|
name: internal
|
|
type: '[ internal | public ]'
|
|
- id: public
|
|
name: public
|
|
type: '[ internal | public ]'
|
|
- id: swift-typegen-source
|
|
name: --swift-typegen-source <string>
|
|
description: 'Where to build supabase-typegen from: a supabase-swift version (3.0.0-alpha.1), a branch (main), a full commit SHA, or a local checkout (./supabase-swift). Default: the supabase-swift pin in the nearest Package.resolved, else the latest 3.x release.'
|
|
default_value: ''
|
|
- id: supabase-init
|
|
title: supabase init
|
|
summary: Set up a project for local development
|
|
description: |
|
|
|
|
|
|
Creates `supabase/config.toml` in the current directory, the starting point for local development with `supabase start`. Run it once in each project.
|
|
|
|
The `supabase` directory can also hold other project files, such as `migrations`, `functions`, and `tests`.
|
|
|
|
To use another directory, set the `SUPABASE_WORKDIR` environment variable or pass the `--workdir` flag.
|
|
|
|
To use OrioleDB as the Postgres storage engine, run `supabase init --use-orioledb`. The command writes the OrioleDB version to `db.orioledb_version` in `supabase/config.toml`; `--experimental` is not required.
|
|
examples:
|
|
- id: basic-usage
|
|
name: Basic usage
|
|
code: supabase init
|
|
response: Finished supabase init.
|
|
- id: from-workdir
|
|
name: Initialize from an existing directory
|
|
code: supabase init --workdir .
|
|
response: Finished supabase init.
|
|
- id: with-orioledb
|
|
name: Initialize with OrioleDB
|
|
code: supabase init --use-orioledb
|
|
response: Finished supabase init.
|
|
tags:
|
|
- local-dev
|
|
links: []
|
|
usage: supabase init [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: force
|
|
name: --force
|
|
description: Write a fresh supabase/config.toml, replacing an existing config.toml and removing any config.json or config.jsonc.
|
|
default_value: 'false'
|
|
- id: interactive
|
|
name: -i, --interactive
|
|
description: Prompt to generate IDE settings for Deno.
|
|
default_value: 'false'
|
|
- id: use-orioledb
|
|
name: --use-orioledb
|
|
description: Use the OrioleDB storage engine for Postgres.
|
|
default_value: 'false'
|
|
- id: supabase-inspect
|
|
title: supabase inspect
|
|
summary: Inspect project tools
|
|
description: Diagnose the health and performance of a project's Postgres database, or export every inspection result as CSV.
|
|
tags:
|
|
- local-dev
|
|
links: []
|
|
subcommands:
|
|
- supabase-inspect-db
|
|
- supabase-inspect-report
|
|
flags: []
|
|
- id: supabase-inspect-db
|
|
title: supabase inspect db
|
|
summary: Inspect database
|
|
description: Run diagnostics on locks, query performance, indexes, table sizes, vacuuming, and connections. Subcommands inspect the local database by default; pass --remote for the linked project, or --remote=<ref|branch|url> for another database.
|
|
tags: []
|
|
links: []
|
|
subcommands:
|
|
- supabase-inspect-db-bloat
|
|
- supabase-inspect-db-blocking
|
|
- supabase-inspect-db-calls
|
|
- supabase-inspect-db-collation-drift
|
|
- supabase-inspect-db-db-stats
|
|
- supabase-inspect-db-index-stats
|
|
- supabase-inspect-db-locks
|
|
- supabase-inspect-db-long-running-queries
|
|
- supabase-inspect-db-outliers
|
|
- supabase-inspect-db-replication-slots
|
|
- supabase-inspect-db-role-stats
|
|
- supabase-inspect-db-table-stats
|
|
- supabase-inspect-db-toast-sizes
|
|
- supabase-inspect-db-traffic-profile
|
|
- supabase-inspect-db-vacuum-stats
|
|
- supabase-inspect-db-xid-age
|
|
flags: []
|
|
- id: supabase-inspect-db-bloat
|
|
title: supabase inspect db bloat
|
|
summary: Show relation bloat
|
|
description: |
|
|
|
|
|
|
Estimate how much space each table and index wastes on dead tuples. Use it to find relations where autovacuum is not keeping up.
|
|
|
|
When data is updated or deleted, Postgres keeps the old row versions as "dead tuples" under [MVCC](https://www.postgresql.org/docs/current/mvcc.html) until [autovacuum](https://supabase.com/docs/guides/platform/database-size#vacuum-operations) cleans them. High bloat can slow queries, cause excessive IOPS, and waste space.
|
|
|
|
Investigate tables with a high bloat ratio to see whether vacuuming is too slow or something else is wrong.
|
|
|
|
```
|
|
TYPE │ SCHEMA NAME │ OBJECT NAME │ BLOAT │ WASTE
|
|
────────┼─────────────┼────────────────────────────┼───────┼─────────────
|
|
table │ public │ very_bloated_table │ 41.0 │ 700 MB
|
|
table │ public │ my_table │ 4.0 │ 76 MB
|
|
table │ public │ happy_table │ 1.0 │ 1472 kB
|
|
index │ public │ happy_table::my_nice_index │ 0.7 │ 880 kB
|
|
```
|
|
examples:
|
|
- id: example-1
|
|
name: Estimate dead-tuple bloat on the local database
|
|
code: supabase inspect db bloat
|
|
- id: example-2
|
|
name: Estimate bloat on the linked project
|
|
code: supabase inspect db bloat --remote
|
|
tags: []
|
|
links: []
|
|
usage: supabase inspect db bloat [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch|url>]
|
|
description: 'Target a remote database: the linked project, or --remote=<ref|branch|url>.'
|
|
default_value: 'false'
|
|
- id: supabase-inspect-db-blocking
|
|
title: supabase inspect db blocking
|
|
summary: Show blocking queries
|
|
description: |
|
|
|
|
|
|
List statements that hold locks and the statements they block. Use it together with `inspect db locks` to decide which statements to terminate to resolve lock contention.
|
|
|
|
```
|
|
BLOCKED PID │ BLOCKING STATEMENT │ BLOCKING DURATION │ BLOCKING PID │ BLOCKED STATEMENT │ BLOCKED DURATION
|
|
──────────────┼──────────────────────────────┼───────────────────┼──────────────┼────────────────────────────────────────────────────────────────────────────────────────┼───────────────────
|
|
253 │ select count(*) from mytable │ 00:00:03.838314 │ 13495 │ UPDATE "mytable" SET "updated_at" = '2023─08─03 14:07:04.746688' WHERE "id" = 83719341 │ 00:00:03.821826
|
|
```
|
|
examples:
|
|
- id: example-1
|
|
name: Show blocked statements on the local database
|
|
code: supabase inspect db blocking
|
|
- id: example-2
|
|
name: Show blocked statements on the linked project
|
|
code: supabase inspect db blocking --remote
|
|
tags: []
|
|
links: []
|
|
usage: supabase inspect db blocking [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch|url>]
|
|
description: 'Target a remote database: the linked project, or --remote=<ref|branch|url>.'
|
|
default_value: 'false'
|
|
- id: supabase-inspect-db-calls
|
|
title: supabase inspect db calls
|
|
summary: Show queries by call count
|
|
description: |
|
|
|
|
|
|
List statements from `pg_stat_statements` ordered by how many times they were called. Use it to find the queries that run most often and are good candidates for optimization.
|
|
|
|
It works like `supabase inspect db outliers`, but sorts by call count instead of total execution time.
|
|
|
|
```
|
|
|
|
QUERY │ TOTAL EXECUTION TIME │ PROPORTION OF TOTAL EXEC TIME │ NUMBER CALLS │ SYNC IO TIME
|
|
─────────────────────────────────────────────────┼──────────────────────┼───────────────────────────────┼──────────────┼──────────────────
|
|
SELECT * FROM users WHERE id = $1 │ 14:50:11.828939 │ 89.8% │ 183,389,757 │ 00:00:00.002018
|
|
SELECT * FROM user_events │ 01:20:23.466633 │ 1.4% │ 78,325 │ 00:00:00
|
|
INSERT INTO users (email, name) VALUES ($1, $2)│ 00:40:11.616882 │ 0.8% │ 54,003 │ 00:00:00.000322
|
|
|
|
```
|
|
examples:
|
|
- id: example-1
|
|
name: List the most frequently called queries on the local database
|
|
code: supabase inspect db calls
|
|
- id: example-2
|
|
name: List the most frequently called queries on the linked project
|
|
code: supabase inspect db calls --remote
|
|
tags: []
|
|
links: []
|
|
usage: supabase inspect db calls [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch|url>]
|
|
description: 'Target a remote database: the linked project, or --remote=<ref|branch|url>.'
|
|
default_value: 'false'
|
|
- id: supabase-inspect-db-collation-drift
|
|
title: supabase inspect db collation-drift
|
|
summary: Show indexes affected by collation version drift
|
|
description: |-
|
|
Show indexes affected by collation version drift, with the fix workflow.
|
|
|
|
Postgres stores btree indexes on text columns in sorted order, using rules from
|
|
the system collation library (glibc or ICU). When that library is upgraded the
|
|
rules can change, and indexes built under the old rules are no longer correctly
|
|
ordered. Postgres reports no error: queries may quietly return missing rows,
|
|
sort incorrectly, or let duplicates past a unique constraint.
|
|
|
|
The output lists the affected indexes and the exact statements to verify
|
|
(amcheck), rebuild (REINDEX CONCURRENTLY), and record the new version — in the
|
|
order they must be run. This command itself is read-only.
|
|
examples:
|
|
- id: example-1
|
|
name: List drifted indexes on the local database
|
|
code: supabase inspect db collation-drift
|
|
- id: example-2
|
|
name: List drifted indexes on the linked project
|
|
code: supabase inspect db collation-drift --remote
|
|
tags: []
|
|
links: []
|
|
usage: supabase inspect db collation-drift [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch|url>]
|
|
description: 'Target a remote database: the linked project, or --remote=<ref|branch|url>.'
|
|
default_value: 'false'
|
|
- id: supabase-inspect-db-db-stats
|
|
title: supabase inspect db db-stats
|
|
summary: Show database stats
|
|
description: Report cache hit rates, database, table, index and TOAST sizes, WAL size, and the time since statistics were reset. Start here for a quick health check of a database.
|
|
examples:
|
|
- id: example-1
|
|
name: Show database stats for the local database
|
|
code: supabase inspect db db-stats
|
|
- id: example-2
|
|
name: Show database stats for the linked project
|
|
code: supabase inspect db db-stats --remote
|
|
tags: []
|
|
links: []
|
|
usage: supabase inspect db db-stats [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch|url>]
|
|
description: 'Target a remote database: the linked project, or --remote=<ref|branch|url>.'
|
|
default_value: 'false'
|
|
- id: supabase-inspect-db-index-stats
|
|
title: supabase inspect db index-stats
|
|
summary: Show index stats
|
|
description: Report each index with its table, columns, size, the share of scans that used it, and whether it is unused. Use it to find large or unused indexes.
|
|
examples:
|
|
- id: example-1
|
|
name: Show index stats for the local database
|
|
code: supabase inspect db index-stats
|
|
- id: example-2
|
|
name: Show index stats for the linked project
|
|
code: supabase inspect db index-stats --remote
|
|
tags: []
|
|
links: []
|
|
usage: supabase inspect db index-stats [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch|url>]
|
|
description: 'Target a remote database: the linked project, or --remote=<ref|branch|url>.'
|
|
default_value: 'false'
|
|
- id: supabase-inspect-db-locks
|
|
title: supabase inspect db locks
|
|
summary: Show exclusive locks
|
|
description: |
|
|
|
|
|
|
List queries that hold an exclusive lock on a relation. Exclusive locks block other operations on that relation and can cause "hung" queries that wait for a lock.
|
|
|
|
To stop a query that hangs or blocks others, connect to the database and run `SELECT pg_cancel_backend(PID);`. If it keeps running, force it to stop with `SELECT pg_terminate_backend(PID);`.
|
|
|
|
```
|
|
PID │ RELNAME │ TRANSACTION ID │ GRANTED │ QUERY │ AGE
|
|
─────────┼─────────┼────────────────┼─────────┼─────────────────────────────────────────┼───────────
|
|
328112 │ null │ 0 │ t │ SELECT * FROM logs; │ 00:04:20
|
|
```
|
|
examples:
|
|
- id: example-1
|
|
name: Show exclusive locks on the local database
|
|
code: supabase inspect db locks
|
|
- id: example-2
|
|
name: Show exclusive locks on the linked project
|
|
code: supabase inspect db locks --remote
|
|
tags: []
|
|
links: []
|
|
usage: supabase inspect db locks [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch|url>]
|
|
description: 'Target a remote database: the linked project, or --remote=<ref|branch|url>.'
|
|
default_value: 'false'
|
|
- id: supabase-inspect-db-long-running-queries
|
|
title: supabase inspect db long-running-queries
|
|
summary: Show long-running queries
|
|
description: |
|
|
|
|
|
|
List queries that have been running for longer than 5 minutes, longest first. Very long-running queries can prevent DDL statements from completing or stop vacuum from updating `relfrozenxid`.
|
|
|
|
```
|
|
PID │ DURATION │ QUERY
|
|
───────┼─────────────────┼───────────────────────────────────────────────────────────────────────────────────────
|
|
19578 | 02:29:11.200129 | EXPLAIN SELECT "students".* FROM "students" WHERE "students"."id" = 1450645 LIMIT 1
|
|
19465 | 02:26:05.542653 | EXPLAIN SELECT "students".* FROM "students" WHERE "students"."id" = 1889881 LIMIT 1
|
|
19632 | 02:24:46.962818 | EXPLAIN SELECT "students".* FROM "students" WHERE "students"."id" = 1581884 LIMIT 1
|
|
```
|
|
examples:
|
|
- id: example-1
|
|
name: Show long-running queries on the local database
|
|
code: supabase inspect db long-running-queries
|
|
- id: example-2
|
|
name: Show long-running queries on the linked project
|
|
code: supabase inspect db long-running-queries --remote
|
|
tags: []
|
|
links: []
|
|
usage: supabase inspect db long-running-queries [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch|url>]
|
|
description: 'Target a remote database: the linked project, or --remote=<ref|branch|url>.'
|
|
default_value: 'false'
|
|
- id: supabase-inspect-db-outliers
|
|
title: supabase inspect db outliers
|
|
summary: Show query outliers by time
|
|
description: |
|
|
|
|
|
|
List statements from `pg_stat_statements` ordered by total execution time. For each one it shows the statement, its total execution time, its share of all execution time, how often it was called, and the time spent on synchronous I/O (reading and writing the file system).
|
|
|
|
An efficient query has a reasonable ratio of calls to total execution time and spends as little time on I/O as possible. Investigate queries with a high total execution time but a low call count, and queries that spend a large share of their time on synchronous I/O.
|
|
|
|
```
|
|
|
|
QUERY │ EXECUTION TIME │ PROPORTION OF EXEC TIME │ NUMBER CALLS │ SYNC IO TIME
|
|
─────────────────────────────────────────┼──────────────────┼─────────────────────────┼──────────────┼───────────────
|
|
SELECT * FROM archivable_usage_events.. │ 154:39:26.431466 │ 72.2% │ 34,211,877 │ 00:00:00
|
|
COPY public.archivable_usage_events (.. │ 50:38:33.198418 │ 23.6% │ 13 │ 13:34:21.00108
|
|
COPY public.usage_events (id, reporte.. │ 02:32:16.335233 │ 1.2% │ 13 │ 00:34:19.784318
|
|
INSERT INTO usage_events (id, retaine.. │ 01:42:59.436532 │ 0.8% │ 12,328,187 │ 00:00:00
|
|
SELECT * FROM usage_events WHERE (alp.. │ 01:18:10.754354 │ 0.6% │ 102,114,301 │ 00:00:00
|
|
```
|
|
examples:
|
|
- id: example-1
|
|
name: List the slowest queries by total execution time on the local database
|
|
code: supabase inspect db outliers
|
|
- id: example-2
|
|
name: List the slowest queries by total execution time on the linked project
|
|
code: supabase inspect db outliers --remote
|
|
tags: []
|
|
links: []
|
|
usage: supabase inspect db outliers [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch|url>]
|
|
description: 'Target a remote database: the linked project, or --remote=<ref|branch|url>.'
|
|
default_value: 'false'
|
|
- id: supabase-inspect-db-replication-slots
|
|
title: supabase inspect db replication-slots
|
|
summary: Show replication slots
|
|
description: |
|
|
|
|
|
|
Show the [logical replication slots](https://www.postgresql.org/docs/current/logical-replication.html) on the database. For each slot it shows whether it is active, the state of the WAL sender process (`startup`, `catchup`, `streaming`, `backup` or `stopping`), the client address, and the replication lag in GB.
|
|
|
|
Use it to check that replication lag stays low. Lag can come from network latency, slow disk I/O, long-running transactions, or a subscriber that cannot consume WAL fast enough.
|
|
|
|
```
|
|
NAME │ ACTIVE │ STATE │ REPLICATION CLIENT ADDRESS │ REPLICATION LAG GB
|
|
─────────────────────────────────────────────┼────────┼─────────┼────────────────────────────┼─────────────────────
|
|
supabase_realtime_replication_slot │ t │ N/A │ N/A │ 0
|
|
datastream │ t │ catchup │ 24.201.24.106 │ 45
|
|
```
|
|
examples:
|
|
- id: example-1
|
|
name: Show replication slots on the local database
|
|
code: supabase inspect db replication-slots
|
|
- id: example-2
|
|
name: Show replication slots on the linked project
|
|
code: supabase inspect db replication-slots --remote
|
|
tags: []
|
|
links: []
|
|
usage: supabase inspect db replication-slots [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch|url>]
|
|
description: 'Target a remote database: the linked project, or --remote=<ref|branch|url>.'
|
|
default_value: 'false'
|
|
- id: supabase-inspect-db-role-stats
|
|
title: supabase inspect db role-stats
|
|
summary: Show role stats
|
|
description: Report each role with its active connections, connection limit, and custom configuration. Use it to see which role uses the most connections.
|
|
examples:
|
|
- id: example-1
|
|
name: Show role stats for the local database
|
|
code: supabase inspect db role-stats
|
|
- id: example-2
|
|
name: Show role stats for the linked project
|
|
code: supabase inspect db role-stats --remote
|
|
tags: []
|
|
links: []
|
|
usage: supabase inspect db role-stats [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch|url>]
|
|
description: 'Target a remote database: the linked project, or --remote=<ref|branch|url>.'
|
|
default_value: 'false'
|
|
- id: supabase-inspect-db-table-stats
|
|
title: supabase inspect db table-stats
|
|
summary: Show table stats
|
|
description: Report each table with its table, index and total size, estimated row count, and sequential scan count. Use it to find the largest tables and how they are scanned.
|
|
examples:
|
|
- id: example-1
|
|
name: Show table stats for the local database
|
|
code: supabase inspect db table-stats
|
|
- id: example-2
|
|
name: Show table stats for the linked project
|
|
code: supabase inspect db table-stats --remote
|
|
tags: []
|
|
links: []
|
|
usage: supabase inspect db table-stats [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch|url>]
|
|
description: 'Target a remote database: the linked project, or --remote=<ref|branch|url>.'
|
|
default_value: 'false'
|
|
- id: supabase-inspect-db-toast-sizes
|
|
title: supabase inspect db toast-sizes
|
|
summary: Show TOAST table sizes and dead chunk counts
|
|
description: |
|
|
|
|
|
|
Show TOAST table sizes and dead chunk counts for each ordinary user table that has a TOAST relation. Materialized views and partitioned parents are not listed.
|
|
|
|
When a row exceeds about 2 kB, Postgres compresses or moves its largest variable-length values (such as `text`, `jsonb` and `bytea`) into a companion TOAST table. TOAST Size includes the TOAST index, and Total Size also includes the table's own indexes.
|
|
|
|
Autovacuum runs on the TOAST table separately from the main heap, so a table that looks healthy in `vacuum-stats` or `bloat` can still have TOAST bloat. A high `TOAST Dead %` means autovacuum is not keeping up, and you may need to run `VACUUM` manually.
|
|
|
|
```
|
|
TABLE │ TOTAL SIZE │ HEAP SIZE │ TOAST SIZE │ TOAST LIVE CHUNKS │ TOAST DEAD CHUNKS │ TOAST DEAD % │ LAST AUTOVACUUM │ LAST VACUUM
|
|
────────────────────────┼────────────┼───────────┼────────────┼───────────────────┼───────────────────┼──────────────┼────────────────────┼─────────────
|
|
public.documents │ 4350 MB │ 800 MB │ 3400 MB │ 250000 │ 18000 │ 6.7 │ 2024-03-01 04:12 │
|
|
public.media_assets │ 905 MB │ 120 MB │ 770 MB │ 80000 │ 200 │ 0.2 │ 2024-03-02 01:45 │
|
|
public.messages │ 365 MB │ 280 MB │ 60 MB │ 95000 │ 0 │ 0.0 │ 2024-03-02 03:10 │
|
|
```
|
|
examples:
|
|
- id: example-1
|
|
name: Show TOAST sizes on the local database
|
|
code: supabase inspect db toast-sizes
|
|
- id: example-2
|
|
name: Show TOAST sizes on the linked project
|
|
code: supabase inspect db toast-sizes --remote
|
|
tags: []
|
|
links: []
|
|
usage: supabase inspect db toast-sizes [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch|url>]
|
|
description: 'Target a remote database: the linked project, or --remote=<ref|branch|url>.'
|
|
default_value: 'false'
|
|
- id: supabase-inspect-db-traffic-profile
|
|
title: supabase inspect db traffic-profile
|
|
summary: Show traffic profile
|
|
description: |
|
|
|
|
|
|
Show how read-heavy or write-heavy each table is, based on block-level I/O. It combines tuple operations from `pg_stat_user_tables` with block I/O from `pg_statio_user_tables`.
|
|
|
|
Each table gets one of these categories:
|
|
|
|
- **Read-Heavy**: read operations are more than 5x write operations (for example 1:10 or 1:50).
|
|
- **Write-Heavy**: write operations are more than 20% of read operations (for example 1:2, 1:4, 2:1 or 10:1).
|
|
- **Balanced**: mixed workload where writes are between 20% and 500% of reads.
|
|
- **Read-Only**: only read operations detected.
|
|
- **Write-Only**: only write operations detected.
|
|
|
|
```
|
|
SCHEMA │ TABLE │ BLOCKS READ │ WRITE TUPLES │ BLOCKS WRITE │ ACTIVITY RATIO
|
|
───────┼──────────────┼─────────────┼──────────────┼──────────────┼────────────────────
|
|
public │ user_events │ 450,234 │ 9,004,680│ 23,450 │ 20:1 (Write-Heavy)
|
|
public │ users │ 89,203 │ 12,451│ 1,203 │ 7.2:1 (Read-Heavy)
|
|
public │ sessions │ 15,402 │ 14,823│ 2,341 │ ≈1:1 (Balanced)
|
|
public │ cache_data │ 123,456 │ 0│ 0 │ Read-Only
|
|
auth │ audit_logs │ 0 │ 98,234│ 12,341 │ Write-Only
|
|
```
|
|
|
|
Only tables with both read and write activity are shown. The ratio threshold that separates "heavy" from balanced is 5:1.
|
|
examples:
|
|
- id: example-1
|
|
name: Show read/write ratios on the local database
|
|
code: supabase inspect db traffic-profile
|
|
- id: example-2
|
|
name: Show read/write ratios on the linked project
|
|
code: supabase inspect db traffic-profile --remote
|
|
tags: []
|
|
links: []
|
|
usage: supabase inspect db traffic-profile [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch|url>]
|
|
description: 'Target a remote database: the linked project, or --remote=<ref|branch|url>.'
|
|
default_value: 'false'
|
|
- id: supabase-inspect-db-vacuum-stats
|
|
title: supabase inspect db vacuum-stats
|
|
summary: Show vacuum stats
|
|
description: |
|
|
|
|
|
|
Show vacuum activity for each table: when it was last vacuumed and auto vacuumed, its row count and dead row count, and whether autovacuum is expected to run.
|
|
|
|
Postgres keeps old row versions as dead tuples under [MVCC](https://www.postgresql.org/docs/current/mvcc.html) until [autovacuum](https://supabase.com/docs/guides/platform/database-size#vacuum-operations) cleans them. If the dead row count is much higher than the row count, or an expected autovacuum has not run for some time, autovacuum may not be keeping up. Tune your vacuum settings or add compute or disk IOPS.
|
|
|
|
```
|
|
SCHEMA │ TABLE │ LAST VACUUM │ LAST AUTO VACUUM │ ROW COUNT │ DEAD ROW COUNT │ EXPECT AUTOVACUUM?
|
|
──────────────────────┼──────────────────────────────────┼─────────────┼──────────────────┼──────────────────────┼────────────────┼─────────────────────
|
|
auth │ users │ │ 2023-06-26 12:34 │ 18,030 │ 0 │ no
|
|
public │ profiles │ │ 2023-06-26 23:45 │ 13,420 │ 28 │ no
|
|
public │ logs │ │ 2023-06-26 01:23 │ 1,313,033 │ 3,318,228 │ yes
|
|
storage │ objects │ │ │ No stats │ 0 │ no
|
|
storage │ buckets │ │ │ No stats │ 0 │ no
|
|
supabase_migrations │ schema_migrations │ │ │ No stats │ 0 │ no
|
|
|
|
```
|
|
examples:
|
|
- id: example-1
|
|
name: Show vacuum stats on the local database
|
|
code: supabase inspect db vacuum-stats
|
|
- id: example-2
|
|
name: Show vacuum stats on the linked project
|
|
code: supabase inspect db vacuum-stats --remote
|
|
tags: []
|
|
links: []
|
|
usage: supabase inspect db vacuum-stats [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch|url>]
|
|
description: 'Target a remote database: the linked project, or --remote=<ref|branch|url>.'
|
|
default_value: 'false'
|
|
- id: supabase-inspect-db-xid-age
|
|
title: supabase inspect db xid-age
|
|
summary: Show XID age for user tables
|
|
description: |
|
|
|
|
|
|
List user tables sorted by transaction ID (XID) age, oldest first. Use it to catch tables that are approaching transaction ID wraparound.
|
|
|
|
Transaction IDs wrap around at about 2.1 billion transactions. Once a table's XID age passes `autovacuum_freeze_max_age` (200 million by default), autovacuum forces a freeze. If the age keeps growing toward the limit, Postgres stops assigning new transaction IDs to protect the data.
|
|
|
|
`transactions_remaining` is the headroom to a 2 billion threshold, kept below the real limit as a safety margin. Treat tables with an XID age above 1.5 billion (`transactions_remaining` below 500 million) as urgent, and run a manual `VACUUM FREEZE` or tune autovacuum.
|
|
|
|
The list covers ordinary user tables only. It leaves out materialized views, TOAST tables, and Supabase-managed schemas, so it does not show the database-wide age. For that, run `SELECT age(datfrozenxid) FROM pg_database WHERE datname = current_database()`.
|
|
|
|
```
|
|
TABLE │ XID AGE │ TRANSACTIONS REMAINING
|
|
─────────────────────────┼───────────┼────────────────────────
|
|
public.events │ 800000000 │ 1200000000
|
|
public.users │ 500000000 │ 1500000000
|
|
public.sessions │ 120000000 │ 1880000000
|
|
```
|
|
examples:
|
|
- id: example-1
|
|
name: Show XID age on the local database
|
|
code: supabase inspect db xid-age
|
|
- id: example-2
|
|
name: Show XID age on the linked project
|
|
code: supabase inspect db xid-age --remote
|
|
tags: []
|
|
links: []
|
|
usage: supabase inspect db xid-age [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch|url>]
|
|
description: 'Target a remote database: the linked project, or --remote=<ref|branch|url>.'
|
|
default_value: 'false'
|
|
- id: supabase-inspect-report
|
|
title: supabase inspect report
|
|
summary: Export all inspect results as CSV files
|
|
description: Run every inspect query and write each result to its own CSV file in a dated folder, then check the results against a set of rules and print a summary. It reports on the local database by default; pass --remote for the linked project, or --remote=<ref|branch|url> for another database.
|
|
examples:
|
|
- id: example-1
|
|
name: Write CSV reports for the local database
|
|
code: supabase inspect report
|
|
- id: example-2
|
|
name: Write CSV reports for the linked project to ./reports
|
|
code: supabase inspect report --remote --output-dir ./reports
|
|
tags: []
|
|
links: []
|
|
usage: supabase inspect report [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: output-dir
|
|
name: --output-dir <string>
|
|
description: Directory to create the dated report folder in.
|
|
default_value: '.'
|
|
- id: remote
|
|
name: --remote[=<ref|branch|url>]
|
|
description: 'Target a remote database: the linked project, or --remote=<ref|branch|url>.'
|
|
default_value: 'false'
|
|
- id: supabase-issue
|
|
title: supabase issue
|
|
summary: Open a GitHub issue form
|
|
description: Open a prefilled Supabase CLI issue form on GitHub to report a bug, request a feature, or flag a documentation problem. Use the flags to prefill form fields, or pass --no-browser to print the URL instead.
|
|
tags:
|
|
- other-commands
|
|
links: []
|
|
subcommands:
|
|
- supabase-issue-bug
|
|
- supabase-issue-docs
|
|
- supabase-issue-feature
|
|
flags: []
|
|
- id: supabase-issue-bug
|
|
title: supabase issue bug
|
|
summary: Open a bug report
|
|
description: Report a problem with the CLI. The form opens with your local CLI details already filled in.
|
|
examples:
|
|
- id: example-1
|
|
name: Open a prefilled bug report for a failing command
|
|
code: supabase issue bug --command "supabase start" --actual-output "database failed to start"
|
|
- id: example-2
|
|
name: Print a prefilled issue URL with a crash report ID
|
|
code: supabase issue bug --crash-report-id "abc123" --no-browser
|
|
tags: []
|
|
links: []
|
|
usage: supabase issue bug [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: actual-output
|
|
name: --actual-output <string>
|
|
description: Actual output or error text.
|
|
default_value: ''
|
|
- id: additional-context
|
|
name: --additional-context <string>
|
|
description: Extra context to prefill on the form.
|
|
default_value: ''
|
|
- id: area
|
|
name: --area <string>
|
|
description: Affected CLI area.
|
|
default_value: ''
|
|
- id: command
|
|
name: --command <string>
|
|
description: Command that failed.
|
|
default_value: ''
|
|
- id: crash-report-id
|
|
name: --crash-report-id <string>
|
|
description: Crash report or support ticket ID, if you have one.
|
|
default_value: ''
|
|
- id: docker-services
|
|
name: --docker-services <string>
|
|
description: Relevant Docker service status or logs.
|
|
default_value: ''
|
|
- id: expected-behavior
|
|
name: --expected-behavior <string>
|
|
description: What you expected to happen.
|
|
default_value: ''
|
|
- id: no-browser
|
|
name: --no-browser
|
|
description: Print the form URL without opening a browser.
|
|
default_value: 'false'
|
|
- id: reproduce
|
|
name: --reproduce <string>
|
|
description: Steps to reproduce the problem.
|
|
default_value: ''
|
|
- id: supabase-issue-docs
|
|
title: supabase issue docs
|
|
summary: Open a documentation issue
|
|
description: Report documentation that is confusing, missing, or incorrect.
|
|
examples:
|
|
- id: example-1
|
|
name: Open a prefilled documentation issue
|
|
code: supabase issue docs --link "https://supabase.com/docs/guides/cli" --problem "The flag description is outdated"
|
|
tags: []
|
|
links: []
|
|
usage: supabase issue docs [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: additional-context
|
|
name: --additional-context <string>
|
|
description: Extra context to prefill on the form.
|
|
default_value: ''
|
|
- id: improvement
|
|
name: --improvement <string>
|
|
description: Suggested improvement to the documentation.
|
|
default_value: ''
|
|
- id: issue-type
|
|
name: --issue-type <string>
|
|
description: Documentation issue type.
|
|
default_value: ''
|
|
- id: link
|
|
name: --link <string>
|
|
description: Relevant documentation link.
|
|
default_value: ''
|
|
- id: no-browser
|
|
name: --no-browser
|
|
description: Print the form URL without opening a browser.
|
|
default_value: 'false'
|
|
- id: problem
|
|
name: --problem <string>
|
|
description: What is confusing, missing, or incorrect.
|
|
default_value: ''
|
|
- id: supabase-issue-feature
|
|
title: supabase issue feature
|
|
summary: Open a feature request
|
|
description: Propose a new CLI feature or an improvement to an existing one.
|
|
examples:
|
|
- id: example-1
|
|
name: Open a prefilled feature request
|
|
code: supabase issue feature --existing-issues --problem "I need to rotate local secrets" --proposed-solution "Add a secrets rotate command"
|
|
tags: []
|
|
links: []
|
|
usage: supabase issue feature [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: additional-context
|
|
name: --additional-context <string>
|
|
description: Extra context to prefill on the form.
|
|
default_value: ''
|
|
- id: alternatives
|
|
name: --alternatives <string>
|
|
description: Alternatives you considered.
|
|
default_value: ''
|
|
- id: area
|
|
name: --area <string>
|
|
description: Affected CLI area.
|
|
default_value: ''
|
|
- id: existing-issues
|
|
name: --existing-issues
|
|
description: Prefill the checklist item for having searched existing issues.
|
|
default_value: 'false'
|
|
- id: no-browser
|
|
name: --no-browser
|
|
description: Print the form URL without opening a browser.
|
|
default_value: 'false'
|
|
- id: problem
|
|
name: --problem <string>
|
|
description: Problem the feature should solve.
|
|
default_value: ''
|
|
- id: proposed-solution
|
|
name: --proposed-solution <string>
|
|
description: Solution you would like to see.
|
|
default_value: ''
|
|
- id: supabase-link
|
|
title: supabase link
|
|
summary: Link to a hosted Supabase project
|
|
description: |
|
|
Connects the current directory to a hosted Supabase project so commands such as `db push --remote` and `db pull --remote` target it. Pass the project ref, or the name of one of its branches, as the argument: `supabase link <ref>`. The `--project-ref` flag still works.
|
|
|
|
Linking records the project ref under `supabase/.temp/`, so later commands target that project without `--project-ref`. It never connects to the database, so it needs no database password.
|
|
|
|
Passing a bare `--remote` to commands such as `db dump`, `db push`, and `db pull` targets the linked project, so link it first.
|
|
examples:
|
|
- id: basic-usage
|
|
name: Basic usage
|
|
code: supabase link abcdefghijklmnopqrst
|
|
response: |
|
|
Finished supabase link.
|
|
- id: link-branch
|
|
name: Link a branch by name
|
|
code: supabase link my-branch
|
|
response: |
|
|
Finished supabase link.
|
|
- id: using-alternate-dns
|
|
name: Link using DNS-over-HTTPS resolver
|
|
code: supabase link abcdefghijklmnopqrst --dns-resolver https
|
|
response: |
|
|
Finished supabase link.
|
|
tags:
|
|
- local-dev
|
|
links: []
|
|
usage: supabase link [ref-or-branch] [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: project-ref
|
|
name: --project-ref <string>
|
|
description: Project ref, or the name of one of its branches; deprecated in favor of the argument.
|
|
default_value: ''
|
|
- id: skip-pooler
|
|
name: --skip-pooler
|
|
description: Use a direct connection instead of the connection pooler.
|
|
default_value: 'false'
|
|
- id: supabase-login
|
|
title: supabase login
|
|
summary: Log in to your Supabase account
|
|
description: |
|
|
|
|
|
|
Signs the CLI in to your Supabase account, so commands that use the Management API can manage your projects, functions, secrets, and more. By default it opens the browser to complete the login; pass a [personal access token](https://supabase.com/dashboard/account/tokens) with `--token` to skip that.
|
|
|
|
The token is stored in native credentials storage (the operating system keyring). If that is unavailable, it is written to a plain text file at `<SUPABASE_HOME or ~/.supabase>/access-token`.
|
|
|
|
> In CI or other environments where you do not want to log in, set the `SUPABASE_ACCESS_TOKEN` environment variable instead.
|
|
|
|
> The Management API client retries retryable failures up to 5 times by default. Set `SUPABASE_API_MAX_RETRIES` to change that. It counts retries after the first attempt, so `0` sends each request once.
|
|
examples:
|
|
- id: basic-usage
|
|
name: Basic usage
|
|
code: supabase login
|
|
response: |
|
|
You can generate an access token from https://supabase.com/dashboard/account/tokens
|
|
Enter your access token: sbp_****************************************
|
|
Finished supabase login.
|
|
tags:
|
|
- local-dev
|
|
links: []
|
|
usage: supabase login [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: name
|
|
name: --name <string>
|
|
description: Name to store the token under in your settings.
|
|
default_value: built-in token name generator
|
|
- id: no-browser
|
|
name: --no-browser
|
|
description: Print the login URL without opening a browser.
|
|
default_value: 'false'
|
|
- id: token
|
|
name: --token <string>
|
|
description: Access token to store instead of using the browser login flow.
|
|
default_value: ''
|
|
- id: supabase-logout
|
|
title: supabase logout
|
|
summary: Log out and delete local credentials
|
|
description: Log out of your Supabase account by deleting the stored access token and project database passwords from this machine. The tokens are not revoked on supabase.com.
|
|
examples:
|
|
- id: example-1
|
|
name: Delete the stored access token
|
|
code: supabase logout
|
|
tags:
|
|
- local-dev
|
|
links: []
|
|
usage: supabase logout [flags]
|
|
subcommands: []
|
|
flags: []
|
|
- id: supabase-logs
|
|
title: supabase logs
|
|
summary: Browse local or hosted logs. Arrows select, Enter details, C copies, L loads more logs, and q quits. Custom SQL uses L to rerun. Pipes and machine output read once. Explicit --output-format text disables the viewer. Use --output-format json|stream-json for structured output; -o/--output is unsupported.
|
|
description: Browse local or hosted logs. Arrows select, Enter details, C copies, L loads more logs, and q quits. Custom SQL uses L to rerun. Pipes and machine output read once. Explicit --output-format text disables the viewer. Use --output-format json|stream-json for structured output; -o/--output is unsupported.
|
|
examples:
|
|
- id: example-1
|
|
name: Browse hosted Postgres errors
|
|
code: supabase logs --remote --service postgres --level error --since 30m
|
|
- id: example-2
|
|
name: Read plain text once
|
|
code: supabase logs --remote --service auth --search "invalid token" --output-format text
|
|
- id: example-3
|
|
name: Export full records as JSON
|
|
code: supabase logs --remote --service postgres --output-format json
|
|
- id: example-4
|
|
name: Query hosted logs with SQL from stdin
|
|
code: cat errors.sql | supabase logs --remote --file - --output-format json
|
|
tags:
|
|
- management-api
|
|
- local-dev
|
|
links: []
|
|
usage: supabase logs [subcommand] [flags]
|
|
subcommands:
|
|
- supabase-logs-sources
|
|
flags:
|
|
- id: file
|
|
name: --file <string>
|
|
description: Read custom hosted log SQL from a file; use - to read stdin.
|
|
default_value: ''
|
|
- id: from
|
|
name: --from <string>
|
|
description: Start at a UTC timestamp ending in Z.
|
|
default_value: ''
|
|
- id: kind
|
|
name: --kind <[ app | requests | builds ]>
|
|
description: Compute stream; requires --service compute.
|
|
default_value: ''
|
|
accepted_values:
|
|
- id: app
|
|
name: app
|
|
type: '[ app | requests | builds ]'
|
|
- id: requests
|
|
name: requests
|
|
type: '[ app | requests | builds ]'
|
|
- id: builds
|
|
name: builds
|
|
type: '[ app | requests | builds ]'
|
|
- id: level
|
|
name: --level <string>
|
|
description: Severity filter; repeat for several levels.
|
|
default_value: '[]'
|
|
accepted_values:
|
|
- id: error
|
|
name: error
|
|
type: string
|
|
- id: warn
|
|
name: warn
|
|
type: string
|
|
- id: warning
|
|
name: warning
|
|
type: string
|
|
- id: info
|
|
name: info
|
|
type: string
|
|
- id: debug
|
|
name: debug
|
|
type: string
|
|
- id: log
|
|
name: log
|
|
type: string
|
|
- id: notice
|
|
name: notice
|
|
type: string
|
|
- id: limit
|
|
name: --limit <int>
|
|
description: Initial filtered history count (default 100, maximum 1000). SQL controls its own LIMIT.
|
|
default_value: '100'
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target a remote log source: the linked project, or --remote=<ref|branch>.'
|
|
default_value: 'false'
|
|
- id: resource
|
|
name: --resource <string>
|
|
description: Compute name or function ID remotely, or a local instance ID.
|
|
default_value: ''
|
|
- id: search
|
|
name: --search <string>
|
|
description: Case-insensitive message substring (hosted only).
|
|
default_value: ''
|
|
- id: service
|
|
name: --service <strings>
|
|
description: Service selector; repeat for multiple services. See logs sources.
|
|
default_value: '[]'
|
|
- id: since
|
|
name: --since <string>
|
|
description: Duration or UTC timestamp; defaults to 1h. Local stacks also accept start.
|
|
default_value: ''
|
|
- id: sql
|
|
name: --sql <string>
|
|
description: Custom hosted log SQL; requires --remote. L reruns the query.
|
|
default_value: ''
|
|
- id: stack
|
|
name: --stack <string>
|
|
description: Select a local stack by name.
|
|
default_value: ''
|
|
- id: stack-id
|
|
name: --stack-id <string>
|
|
description: Select a local stack by ID.
|
|
default_value: ''
|
|
- id: to
|
|
name: --to <string>
|
|
description: Initial end at a UTC timestamp ending in Z. L advances to now.
|
|
default_value: ''
|
|
- id: supabase-logs-sources
|
|
title: supabase logs sources
|
|
summary: List supported sources and filters. Hosted entries describe capabilities and do not imply that rows exist. Local entries list retained stack instances. Use --output-format json|stream-json for structured output; -o/--output is unsupported.
|
|
description: List supported sources and filters. Hosted entries describe capabilities and do not imply that rows exist. Local entries list retained stack instances. Use --output-format json|stream-json for structured output; -o/--output is unsupported.
|
|
tags: []
|
|
links: []
|
|
usage: supabase logs sources [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target a remote log source: the linked project, or --remote=<ref|branch>.'
|
|
default_value: 'false'
|
|
- id: service
|
|
name: --service <string>
|
|
description: Describe one service.
|
|
default_value: ''
|
|
- id: stack
|
|
name: --stack <string>
|
|
description: Select a local stack by name.
|
|
default_value: ''
|
|
- id: stack-id
|
|
name: --stack-id <string>
|
|
description: Select a local stack by ID.
|
|
default_value: ''
|
|
- id: supabase-migration
|
|
title: supabase migration
|
|
summary: Manage database migrations
|
|
description: Create, list, apply, squash, and repair the SQL migration files in supabase/migrations and the migration history of a database.
|
|
tags:
|
|
- local-dev
|
|
links: []
|
|
subcommands:
|
|
- supabase-migration-down
|
|
- supabase-migration-fetch
|
|
- supabase-migration-list
|
|
- supabase-migration-new
|
|
- supabase-migration-repair
|
|
- supabase-migration-squash
|
|
- supabase-migration-up
|
|
flags: []
|
|
- id: supabase-migration-down
|
|
title: supabase migration down
|
|
summary: Revert the last applied migrations
|
|
description: Revert the most recent migrations by dropping the user schemas of a database and re-applying the migrations before them. This discards all data in the database, so use it with care.
|
|
examples:
|
|
- id: example-1
|
|
name: Revert the most recent migration on the local database
|
|
code: supabase migration down --last 1
|
|
tags: []
|
|
links: []
|
|
usage: supabase migration down [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: last
|
|
name: --last <int>
|
|
description: Number of most recent migrations to revert.
|
|
default_value: '1'
|
|
- id: remote
|
|
name: --remote[=<ref|branch|url>]
|
|
description: 'Target a remote database: the linked project, or --remote=<ref|branch|url>.'
|
|
default_value: 'false'
|
|
- id: supabase-migration-fetch
|
|
title: supabase migration fetch
|
|
summary: Fetch migration files from a database
|
|
description: Download the migrations recorded in a database's migration history table and write them to supabase/migrations. Use it when the history of a project is missing from your local files.
|
|
examples:
|
|
- id: example-1
|
|
name: Write the migration history of the linked project to supabase/migrations
|
|
code: supabase migration fetch --remote
|
|
tags: []
|
|
links: []
|
|
usage: supabase migration fetch [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch|url>]
|
|
description: 'Target a remote database: the linked project, or --remote=<ref|branch|url>.'
|
|
default_value: 'false'
|
|
- id: supabase-migration-list
|
|
title: supabase migration list
|
|
summary: List local and applied migrations
|
|
description: |
|
|
|
|
|
|
Compare the migration files in `supabase/migrations` with the migration history of a database. Use it to see which migrations are missing on either side.
|
|
|
|
It lists the local database by default. Pass `--remote` to list the linked project instead, which requires running `supabase link`. Pass `--remote=<ref|branch|url>` to list another project, a branch of the linked project, or a database URL such as a self-hosted database.
|
|
|
|
`--linked`, `--project-ref`, `--db-url` and `--local` still work in v3 but are deprecated and removed in v4; use `--remote`.
|
|
|
|
> Note that URL strings must be escaped according to [RFC 3986](https://www.rfc-editor.org/rfc/rfc3986).
|
|
|
|
The target database tracks applied migrations in the `supabase_migrations.schema_migrations` table. The second column is headed `Remote` for a project or database URL passed with `--remote`, and `Local DB` for the local database. Only the timestamps are compared to identify differences.
|
|
|
|
If the local and remote migration history differ, you can resolve them with the `migration repair` command.
|
|
examples:
|
|
- id: basic-usage
|
|
name: Basic usage
|
|
code: supabase migration list --remote
|
|
response: |2
|
|
LOCAL │ REMOTE │ TIME (UTC)
|
|
─────────────────┼────────────────┼──────────────────────
|
|
│ 20230103054303 │ 2023-01-03 05:43:03
|
|
│ 20230103093141 │ 2023-01-03 09:31:41
|
|
20230222032233 │ │ 2023-02-22 03:22:33
|
|
- id: with-db-url
|
|
name: Connect to self-hosted database
|
|
code: supabase migration list --remote='postgres://postgres[:percent_encoded_password]@db.example.com[:port]/postgres'
|
|
response: |2
|
|
LOCAL │ REMOTE │ TIME (UTC)
|
|
─────────────────┼────────────────┼──────────────────────
|
|
20230103054303 │ 20230103054303 │ 2023-01-03 05:43:03
|
|
20230103093141 │ 20230103093141 │ 2023-01-03 09:31:41
|
|
tags: []
|
|
links: []
|
|
usage: supabase migration list [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: password
|
|
name: -p, --password <string>
|
|
description: Database password for the project selected with --remote; ignored for the local database and database URLs.
|
|
default_value: ''
|
|
- id: remote
|
|
name: --remote[=<ref|branch|url>]
|
|
description: 'Target a remote database: the linked project, or --remote=<ref|branch|url>.'
|
|
default_value: 'false'
|
|
- id: supabase-migration-new
|
|
title: supabase migration new
|
|
summary: Create an empty migration file
|
|
description: |
|
|
|
|
|
|
Create an empty migration file for you to fill in. Output from other commands, such as `db diff`, can be piped to `migration new <name>` through stdin.
|
|
|
|
The command creates the `supabase/migrations` directory in your current `workdir` if it does not exist. Every migration file in this directory is named `<timestamp>_<name>.sql`.
|
|
examples:
|
|
- id: basic-usage
|
|
name: Basic usage
|
|
code: supabase migration new schema_test
|
|
response: |
|
|
Created new migration at supabase/migrations/20230306095710_schema_test.sql.
|
|
- id: pipe-stdin
|
|
name: With statements piped from stdin
|
|
code: echo "create schema if not exists test;" | supabase migration new schema_test
|
|
response: |
|
|
Created new migration at supabase/migrations/20230306095710_schema_test.sql.
|
|
tags: []
|
|
links: []
|
|
usage: supabase migration new <migration name> [flags]
|
|
subcommands: []
|
|
flags: []
|
|
- id: supabase-migration-repair
|
|
title: supabase migration repair
|
|
summary: Repair the migration history
|
|
description: |
|
|
|
|
|
|
Mark migrations as applied or reverted in the migration history table, without running them. Use it when the local files and the history of a database are out of sync.
|
|
|
|
It repairs the local database by default. Pass `--remote` to repair the linked project, which requires running `supabase link`. Pass `--remote=<ref|branch|url>` to repair another project, a branch of the linked project, or a specific database.
|
|
|
|
Repairing a hosted database asks for confirmation before it changes anything (the default answer is No). Pass `--yes` to confirm in scripts and other non-interactive runs.
|
|
|
|
`--linked`, `--project-ref`, `--db-url` and `--local` still work in v3 but are deprecated and removed in v4; use `--remote`.
|
|
|
|
Marking a migration as `reverted` deletes its record from the migration history table, and marking it as `applied` inserts a new record.
|
|
|
|
## Example
|
|
|
|
Your migration history may look like the table below, with entries missing on either the local or the remote side.
|
|
|
|
```bash
|
|
$ supabase migration list --remote
|
|
Target: project My Project (abcdefghijklmnopqrst) · production
|
|
LOCAL │ REMOTE │ TIME (UTC)
|
|
─────────────────┼────────────────┼──────────────────────
|
|
│ 20230103054303 │ 2023-01-03 05:43:03
|
|
20230103054315 │ │ 2023-01-03 05:43:15
|
|
```
|
|
|
|
To reset your migration history to a clean state, first delete your local migration file.
|
|
|
|
```bash
|
|
$ rm supabase/migrations/20230103054315_remote_commit.sql
|
|
|
|
$ supabase migration list --remote
|
|
Target: project My Project (abcdefghijklmnopqrst) · production
|
|
LOCAL │ REMOTE │ TIME (UTC)
|
|
─────────────────┼────────────────┼──────────────────────
|
|
│ 20230103054303 │ 2023-01-03 05:43:03
|
|
```
|
|
|
|
Then mark the remote migration `20230103054303` as reverted.
|
|
|
|
```bash
|
|
$ supabase migration repair 20230103054303 --status reverted --remote
|
|
Target: project My Project (abcdefghijklmnopqrst) · production
|
|
• 20230103054303
|
|
◇ Mark 1 migration as reverted on project My Project (abcdefghijklmnopqrst) · production?
|
|
│ Yes
|
|
Repaired migration history: [20230103054303] => reverted
|
|
Finished supabase migration repair.
|
|
|
|
$ supabase migration list --remote
|
|
Target: project My Project (abcdefghijklmnopqrst) · production
|
|
LOCAL │ REMOTE │ TIME (UTC)
|
|
─────────────────┼────────────────┼──────────────────────
|
|
```
|
|
|
|
Now you can run `db pull` again to dump the remote schema as a local migration file.
|
|
|
|
```bash
|
|
$ supabase db pull --remote
|
|
Target: project My Project (abcdefghijklmnopqrst) · production
|
|
Write 1 migration file to supabase/migrations.
|
|
Record them as applied in the remote migration history.
|
|
◇ Update the remote migration history table on project My Project (abcdefghijklmnopqrst) · production?
|
|
│ Yes
|
|
Schema written to supabase/migrations/20240414044403_remote_schema.sql
|
|
Finished supabase db pull.
|
|
|
|
$ supabase migration list --remote
|
|
Target: project My Project (abcdefghijklmnopqrst) · production
|
|
LOCAL │ REMOTE │ TIME (UTC)
|
|
─────────────────┼────────────────┼──────────────────────
|
|
20240414044403 │ 20240414044403 │ 2024-04-14 04:44:03
|
|
```
|
|
examples:
|
|
- id: basic-usage
|
|
name: Mark a migration as reverted
|
|
code: supabase migration repair 20230103054303 --status reverted --yes --remote
|
|
response: |
|
|
Target: project My Project (abcdefghijklmnopqrst) · production
|
|
Confirmed by --yes: Mark 1 migration as reverted on project My Project (abcdefghijklmnopqrst) · production
|
|
Repaired migration history: [20230103054303] => reverted
|
|
- id: mark-applied
|
|
name: Mark a migration as applied
|
|
code: supabase migration repair 20230222032233 --status applied --yes --remote
|
|
response: |
|
|
Target: project My Project (abcdefghijklmnopqrst) · production
|
|
Confirmed by --yes: Mark 1 migration as applied on project My Project (abcdefghijklmnopqrst) · production
|
|
Repaired migration history: [20230222032233] => applied
|
|
tags: []
|
|
links: []
|
|
usage: supabase migration repair [version] ... [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: password
|
|
name: -p, --password <string>
|
|
description: Database password for the project selected with --remote; ignored for the local database and database URLs.
|
|
default_value: ''
|
|
- id: remote
|
|
name: --remote[=<ref|branch|url>]
|
|
description: 'Target a remote database: the linked project, or --remote=<ref|branch|url>.'
|
|
default_value: 'false'
|
|
- id: status
|
|
name: --status <[ applied | reverted ]>
|
|
description: Status to record for the given migration versions.
|
|
required: true
|
|
default_value: ''
|
|
accepted_values:
|
|
- id: applied
|
|
name: applied
|
|
type: '[ applied | reverted ]'
|
|
- id: reverted
|
|
name: reverted
|
|
type: '[ applied | reverted ]'
|
|
- id: supabase-migration-squash
|
|
title: supabase migration squash
|
|
summary: Squash migrations into a single file
|
|
description: |
|
|
|
|
|
|
Combine your local migrations into a single file. Use it to remove repeated changes to the same schema from your migration history.
|
|
|
|
The squashed migration is equivalent to a schema-only dump of the local database after applying your existing migration files. By default, the latest `<timestamp>_<name>.sql` file is updated to contain it. Choose another target with `--version <timestamp>`.
|
|
|
|
Data statements such as insert, update, or delete are omitted from the squashed migration, so you must add them back in a new migration file. This includes cron jobs, storage buckets, and any encrypted secrets in vault. If your `supabase/migrations` directory is empty, the command does nothing.
|
|
|
|
Squashing rewrites your local migration files. When the target is a hosted database (`--remote` or `--remote=<ref|branch|url>`), it also resets the remote migration history table to the squashed migration, and asks for confirmation before changing any file (the default answer is No). Pass `--yes` to confirm in scripts and other non-interactive runs.
|
|
|
|
With the default local target, the command only squashes the files and suggests running `supabase migration repair --status applied --remote` for the remote history.
|
|
|
|
`--linked`, `--project-ref`, `--db-url` and `--local` still work in v3 but are deprecated and removed in v4; use `--remote`.
|
|
examples:
|
|
- id: example-1
|
|
name: Squash all local migrations into the latest file
|
|
code: supabase migration squash
|
|
- id: example-2
|
|
name: Squash migrations up to a given version
|
|
code: supabase migration squash --version 20240101000000
|
|
tags: []
|
|
links: []
|
|
usage: supabase migration squash [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: password
|
|
name: -p, --password <string>
|
|
description: Database password for the project selected with --remote; ignored for the local database and database URLs.
|
|
default_value: ''
|
|
- id: remote
|
|
name: --remote[=<ref|branch|url>]
|
|
description: 'Target a remote database: the linked project, or --remote=<ref|branch|url>.'
|
|
default_value: 'false'
|
|
- id: version
|
|
name: --version <string>
|
|
description: Squash up to the specified migration version.
|
|
default_value: ''
|
|
- id: supabase-migration-up
|
|
title: supabase migration up
|
|
summary: Apply pending migrations to a database
|
|
description: Apply local migrations that are not yet in the migration history of a database. Unlike db push, it only runs migrations and does not push roles, seeds, or vault secrets.
|
|
examples:
|
|
- id: example-1
|
|
name: Apply pending migrations to the local database
|
|
code: supabase migration up
|
|
- id: example-2
|
|
name: Apply all missing migrations to the linked project
|
|
code: supabase migration up --remote --include-all
|
|
tags: []
|
|
links: []
|
|
usage: supabase migration up [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: include-all
|
|
name: --include-all
|
|
description: Include all migrations not found in the migration history table.
|
|
default_value: 'false'
|
|
- id: remote
|
|
name: --remote[=<ref|branch|url>]
|
|
description: 'Target a remote database: the linked project, or --remote=<ref|branch|url>.'
|
|
default_value: 'false'
|
|
- id: supabase-network-bans
|
|
title: supabase network-bans
|
|
summary: Manage network bans
|
|
description: |
|
|
|
|
|
|
Lists and lifts temporary bans on IP addresses. An IP is banned when its traffic looks abusive, for example after multiple failed auth attempts.
|
|
|
|
`remove` asks for confirmation (default No) before unblocking. Pass `--yes` to confirm without asking; JSON, stream-json, `-o` and non-interactive runs fail without it.
|
|
tags:
|
|
- management-api
|
|
links: []
|
|
subcommands:
|
|
- supabase-network-bans-get
|
|
- supabase-network-bans-remove
|
|
flags: []
|
|
- id: supabase-network-bans-get
|
|
title: supabase network-bans get
|
|
summary: Get the current network bans
|
|
description: Lists the IP addresses currently banned from connecting to your project's database.
|
|
examples:
|
|
- id: example-1
|
|
name: List banned IPs for a project
|
|
code: supabase network-bans get --experimental --remote=<project-ref>
|
|
tags: []
|
|
links: []
|
|
usage: supabase network-bans get [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: experimental
|
|
name: --experimental
|
|
description: enable experimental features
|
|
required: true
|
|
default_value: 'false'
|
|
- id: supabase-network-bans-remove
|
|
title: supabase network-bans remove
|
|
summary: Remove a network ban
|
|
description: Unblocks banned IP addresses. If you pass no IP, it unblocks the IP address of the machine you run it from.
|
|
examples:
|
|
- id: example-1
|
|
name: Unban a single IP address
|
|
code: supabase network-bans remove --db-unban-ip 203.0.113.7 --experimental --remote=<project-ref>
|
|
- id: example-2
|
|
name: Unban the IP address of this machine
|
|
code: supabase network-bans remove --experimental --remote=<project-ref>
|
|
tags: []
|
|
links: []
|
|
usage: supabase network-bans remove [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: db-unban-ip
|
|
name: --db-unban-ip <strings>
|
|
description: IP address to unblock, comma-separated or repeated.
|
|
default_value: '[]'
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: experimental
|
|
name: --experimental
|
|
description: enable experimental features
|
|
required: true
|
|
default_value: 'false'
|
|
- id: supabase-network-restrictions
|
|
title: supabase network-restrictions
|
|
summary: Manage network restrictions
|
|
description: Limit which IP ranges can connect directly to your project's database.
|
|
tags:
|
|
- management-api
|
|
links: []
|
|
subcommands:
|
|
- supabase-network-restrictions-get
|
|
- supabase-network-restrictions-update
|
|
flags: []
|
|
- id: supabase-network-restrictions-get
|
|
title: supabase network-restrictions get
|
|
summary: Get the current network restrictions
|
|
description: Shows the CIDR ranges allowed to connect to your project's database, and whether they are applied.
|
|
examples:
|
|
- id: example-1
|
|
name: Show the allowed CIDR ranges for a project
|
|
code: supabase network-restrictions get --experimental --remote=<project-ref>
|
|
tags: []
|
|
links: []
|
|
usage: supabase network-restrictions get [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: experimental
|
|
name: --experimental
|
|
description: enable experimental features
|
|
required: true
|
|
default_value: 'false'
|
|
- id: supabase-network-restrictions-update
|
|
title: supabase network-restrictions update
|
|
summary: Update network restrictions
|
|
description: Sets the CIDR ranges allowed to connect to your project's database. By default the ranges you pass replace the existing ones; use `--append` to add to them.
|
|
examples:
|
|
- id: example-1
|
|
name: Replace the allowed CIDR ranges
|
|
code: supabase network-restrictions update --db-allow-cidr 203.0.113.0/24 --experimental --remote=<project-ref>
|
|
- id: example-2
|
|
name: Add a CIDR range to the existing ones
|
|
code: supabase network-restrictions update --db-allow-cidr 198.51.100.0/24 --append --experimental --remote=<project-ref>
|
|
tags: []
|
|
links: []
|
|
usage: supabase network-restrictions update [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: append
|
|
name: --append
|
|
description: Append to existing restrictions instead of replacing them.
|
|
default_value: 'false'
|
|
- id: bypass-cidr-checks
|
|
name: --bypass-cidr-checks
|
|
description: Allow private IP ranges that CIDR validation would otherwise reject.
|
|
default_value: 'false'
|
|
- id: db-allow-cidr
|
|
name: --db-allow-cidr <strings>
|
|
description: CIDR range allowed to connect to the database, comma-separated or repeated.
|
|
default_value: '[]'
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: experimental
|
|
name: --experimental
|
|
description: enable experimental features
|
|
required: true
|
|
default_value: 'false'
|
|
- id: supabase-notebooks
|
|
title: supabase notebooks
|
|
summary: Manage notebooks
|
|
description: Sync notebooks, which hold SQL and markdown cells, between your project and `supabase/notebooks/<name>.json`.
|
|
tags:
|
|
- management-api
|
|
links: []
|
|
subcommands:
|
|
- supabase-notebooks-pull
|
|
- supabase-notebooks-push
|
|
flags: []
|
|
- id: supabase-notebooks-pull
|
|
title: supabase notebooks pull
|
|
summary: Pull notebooks from a project
|
|
description: |-
|
|
Write the notebooks of the linked project to `supabase/notebooks`.
|
|
|
|
Without a notebook id, existing local files are kept and only missing notebooks are written.
|
|
examples:
|
|
- id: example-1
|
|
name: Pull every notebook from the linked project
|
|
code: supabase notebooks pull
|
|
- id: example-2
|
|
name: Replace the local copy of one notebook by id
|
|
code: supabase notebooks pull 44444444-4444-4444-8444-444444444444
|
|
tags: []
|
|
links: []
|
|
usage: supabase notebooks pull [Notebook id] [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: supabase-notebooks-push
|
|
title: supabase notebooks push
|
|
summary: Push local notebooks to a project
|
|
description: |-
|
|
Upload the notebooks in `supabase/notebooks` to the linked project.
|
|
|
|
When you push all notebooks, the command asks what to do about project notebooks that the directory does not have.
|
|
examples:
|
|
- id: example-1
|
|
name: Push every notebook in supabase/notebooks to the linked project
|
|
code: supabase notebooks push
|
|
- id: example-2
|
|
name: Push a single notebook by name
|
|
code: supabase notebooks push sales-dashboard
|
|
tags: []
|
|
links: []
|
|
usage: supabase notebooks push [Notebook name] [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: supabase-orgs
|
|
title: supabase orgs
|
|
summary: Manage organizations
|
|
description: List the organizations you belong to and create new ones.
|
|
tags:
|
|
- management-api
|
|
links: []
|
|
subcommands:
|
|
- supabase-orgs-create
|
|
- supabase-orgs-list
|
|
flags: []
|
|
- id: supabase-orgs-create
|
|
title: supabase orgs create
|
|
summary: Create an organization
|
|
description: Create a new organization under your account, which you can then create projects in.
|
|
examples:
|
|
- id: example-1
|
|
name: Create an organization
|
|
code: supabase orgs create "My Organization"
|
|
tags: []
|
|
links: []
|
|
usage: supabase orgs create <name> [flags]
|
|
subcommands: []
|
|
flags: []
|
|
- id: supabase-orgs-list
|
|
title: supabase orgs list
|
|
summary: List all organizations
|
|
description: Show the organizations the logged-in user belongs to, with their IDs.
|
|
examples:
|
|
- id: example-1
|
|
name: List all organizations you belong to
|
|
code: supabase orgs list
|
|
- id: example-2
|
|
name: List organizations as JSON
|
|
code: supabase orgs list --output-format json
|
|
tags: []
|
|
links: []
|
|
usage: supabase orgs list [flags]
|
|
subcommands: []
|
|
flags: []
|
|
- id: supabase-postgres-config
|
|
title: supabase postgres-config
|
|
summary: Manage Postgres database config
|
|
description: Inspect and override Postgres settings for your project's database.
|
|
tags:
|
|
- management-api
|
|
links: []
|
|
subcommands:
|
|
- supabase-postgres-config-delete
|
|
- supabase-postgres-config-get
|
|
- supabase-postgres-config-update
|
|
flags: []
|
|
- id: supabase-postgres-config-delete
|
|
title: supabase postgres-config delete
|
|
summary: Delete Postgres database config overrides
|
|
description: Removes the named overrides so those settings return to their defaults. The database restarts afterwards unless you pass `--no-restart`.
|
|
examples:
|
|
- id: example-1
|
|
name: Delete a Postgres config override
|
|
code: supabase postgres-config delete --config work_mem --experimental --remote=<project-ref>
|
|
tags: []
|
|
links: []
|
|
usage: supabase postgres-config delete [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: config
|
|
name: --config <strings>
|
|
description: Config keys to delete, comma-separated or repeated.
|
|
default_value: '[]'
|
|
- id: no-restart
|
|
name: --no-restart
|
|
description: Do not restart the database after deleting config.
|
|
default_value: 'false'
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: experimental
|
|
name: --experimental
|
|
description: enable experimental features
|
|
required: true
|
|
default_value: 'false'
|
|
- id: supabase-postgres-config-get
|
|
title: supabase postgres-config get
|
|
summary: Get Postgres database config
|
|
description: Shows the custom Postgres settings you have set for your project.
|
|
examples:
|
|
- id: example-1
|
|
name: Show the Postgres config overrides of a project
|
|
code: supabase postgres-config get --experimental --remote=<project-ref>
|
|
tags: []
|
|
links: []
|
|
usage: supabase postgres-config get [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: experimental
|
|
name: --experimental
|
|
description: enable experimental features
|
|
required: true
|
|
default_value: 'false'
|
|
- id: supabase-postgres-config-update
|
|
title: supabase postgres-config update
|
|
summary: Update Postgres database config
|
|
description: |
|
|
|
|
|
|
Sets Postgres setting overrides for your project. Overriding the default Postgres config could result in unstable database behavior.
|
|
|
|
Custom configuration also overrides the optimizations generated based on the compute add-ons in use.
|
|
|
|
The update asks for confirmation (default No) before changing the overrides. Pass `--yes` to confirm without asking; JSON, stream-json, `-o` and non-interactive runs fail without it.
|
|
examples:
|
|
- id: example-1
|
|
name: Set a Postgres config override
|
|
code: supabase postgres-config update --config work_mem=100MB --experimental --remote=<project-ref>
|
|
- id: example-2
|
|
name: Replace all overrides without restarting
|
|
code: supabase postgres-config update --config work_mem=100MB --replace-existing-overrides --no-restart --experimental --remote=<project-ref>
|
|
tags: []
|
|
links: []
|
|
usage: supabase postgres-config update [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: config
|
|
name: --config <strings>
|
|
description: Config override as a `key=value` pair, comma-separated or repeated.
|
|
default_value: '[]'
|
|
- id: no-restart
|
|
name: --no-restart
|
|
description: Do not restart the database after updating config.
|
|
default_value: 'false'
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: replace-existing-overrides
|
|
name: --replace-existing-overrides
|
|
description: If true, replaces all existing overrides with the ones provided. If false (default), merges existing overrides with the ones provided.
|
|
default_value: 'false'
|
|
- id: experimental
|
|
name: --experimental
|
|
description: enable experimental features
|
|
required: true
|
|
default_value: 'false'
|
|
- id: supabase-projects
|
|
title: supabase projects
|
|
summary: Manage projects
|
|
description: |
|
|
|
|
|
|
Create, list and delete Supabase projects, and read their API keys, without opening the dashboard. This is useful for automation scripts and for provisioning environments repeatably.
|
|
|
|
Commands that change your account or projects ask for confirmation first: `create` defaults to yes, `delete` defaults to no.
|
|
|
|
Pass `--yes` (or set `SUPABASE_YES` in your shell) to confirm in scripts and CI. Without it, a run that cannot prompt fails before making any change.
|
|
tags:
|
|
- management-api
|
|
links: []
|
|
subcommands:
|
|
- supabase-projects-api-keys
|
|
- supabase-projects-create
|
|
- supabase-projects-delete
|
|
- supabase-projects-list
|
|
flags: []
|
|
- id: supabase-projects-api-keys
|
|
title: supabase projects api-keys
|
|
summary: List API keys for a project
|
|
description: Show the API keys of a project. Secret keys are masked unless you pass `--reveal`.
|
|
examples:
|
|
- id: example-1
|
|
name: List all API keys for a project
|
|
code: supabase projects api-keys --remote=abcdefghijklmnopqrst
|
|
- id: example-2
|
|
name: List API keys with the secret keys revealed in full
|
|
code: supabase projects api-keys --reveal --output json
|
|
tags: []
|
|
links: []
|
|
usage: supabase projects api-keys [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: reveal
|
|
name: --reveal
|
|
description: Reveal secret API keys in full, such as `sb_secret_...`.
|
|
default_value: 'false'
|
|
- id: supabase-projects-create
|
|
title: supabase projects create
|
|
summary: Create a project
|
|
description: |-
|
|
Create a new Supabase project in an organization.
|
|
|
|
In an interactive terminal the command prompts for missing values. Without one, you must pass the project name, `--org-id`, `--db-password` and `--region`.
|
|
examples:
|
|
- id: example-1
|
|
name: Create a new project
|
|
code: supabase projects create my-project --org-id cool-green-pqdr0qc --db-password ******** --region us-east-1
|
|
tags: []
|
|
links: []
|
|
usage: supabase projects create [name] [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: db-password
|
|
name: --db-password <string>
|
|
description: Database password for the project.
|
|
default_value: ''
|
|
- id: high-availability
|
|
name: --high-availability
|
|
description: Enable high availability for the project.
|
|
default_value: 'false'
|
|
- id: org-id
|
|
name: --org-id <string>
|
|
description: Organization ID to create the project in.
|
|
default_value: ''
|
|
- id: region
|
|
name: --region <string>
|
|
description: Region to host the project in, ideally close to your users.
|
|
default_value: ''
|
|
accepted_values:
|
|
- id: ap-east-1
|
|
name: ap-east-1
|
|
type: string
|
|
- id: ap-northeast-1
|
|
name: ap-northeast-1
|
|
type: string
|
|
- id: ap-northeast-2
|
|
name: ap-northeast-2
|
|
type: string
|
|
- id: ap-south-1
|
|
name: ap-south-1
|
|
type: string
|
|
- id: ap-southeast-1
|
|
name: ap-southeast-1
|
|
type: string
|
|
- id: ap-southeast-2
|
|
name: ap-southeast-2
|
|
type: string
|
|
- id: ca-central-1
|
|
name: ca-central-1
|
|
type: string
|
|
- id: eu-central-1
|
|
name: eu-central-1
|
|
type: string
|
|
- id: eu-central-2
|
|
name: eu-central-2
|
|
type: string
|
|
- id: eu-north-1
|
|
name: eu-north-1
|
|
type: string
|
|
- id: eu-west-1
|
|
name: eu-west-1
|
|
type: string
|
|
- id: eu-west-2
|
|
name: eu-west-2
|
|
type: string
|
|
- id: eu-west-3
|
|
name: eu-west-3
|
|
type: string
|
|
- id: sa-east-1
|
|
name: sa-east-1
|
|
type: string
|
|
- id: us-east-1
|
|
name: us-east-1
|
|
type: string
|
|
- id: us-east-2
|
|
name: us-east-2
|
|
type: string
|
|
- id: us-west-1
|
|
name: us-west-1
|
|
type: string
|
|
- id: us-west-2
|
|
name: us-west-2
|
|
type: string
|
|
- id: size
|
|
name: --size <string>
|
|
description: Instance size of the project.
|
|
default_value: ''
|
|
accepted_values:
|
|
- id: large
|
|
name: large
|
|
type: string
|
|
- id: medium
|
|
name: medium
|
|
type: string
|
|
- id: micro
|
|
name: micro
|
|
type: string
|
|
- id: 12xlarge
|
|
name: 12xlarge
|
|
type: string
|
|
- id: 16xlarge
|
|
name: 16xlarge
|
|
type: string
|
|
- id: 24xlarge
|
|
name: 24xlarge
|
|
type: string
|
|
- id: 24xlarge_high_memory
|
|
name: 24xlarge_high_memory
|
|
type: string
|
|
- id: 24xlarge_optimized_cpu
|
|
name: 24xlarge_optimized_cpu
|
|
type: string
|
|
- id: 24xlarge_optimized_memory
|
|
name: 24xlarge_optimized_memory
|
|
type: string
|
|
- id: 2xlarge
|
|
name: 2xlarge
|
|
type: string
|
|
- id: 48xlarge
|
|
name: 48xlarge
|
|
type: string
|
|
- id: 48xlarge_high_memory
|
|
name: 48xlarge_high_memory
|
|
type: string
|
|
- id: 48xlarge_optimized_cpu
|
|
name: 48xlarge_optimized_cpu
|
|
type: string
|
|
- id: 48xlarge_optimized_memory
|
|
name: 48xlarge_optimized_memory
|
|
type: string
|
|
- id: 4xlarge
|
|
name: 4xlarge
|
|
type: string
|
|
- id: 8xlarge
|
|
name: 8xlarge
|
|
type: string
|
|
- id: small
|
|
name: small
|
|
type: string
|
|
- id: xlarge
|
|
name: xlarge
|
|
type: string
|
|
- id: supabase-projects-delete
|
|
title: supabase projects delete
|
|
summary: Delete a project
|
|
description: |-
|
|
Delete a Supabase project by its ref. In an interactive terminal, omit the ref to pick a project from a list.
|
|
|
|
Asks for confirmation before changing anything; pass `--yes` in scripts and CI.
|
|
examples:
|
|
- id: example-1
|
|
name: Delete a project by ref
|
|
code: supabase projects delete abcdefghijklmnopqrst
|
|
tags: []
|
|
links: []
|
|
usage: supabase projects delete [ref] [flags]
|
|
subcommands: []
|
|
flags: []
|
|
- id: supabase-projects-list
|
|
title: supabase projects list
|
|
summary: List all projects
|
|
description: Show the projects the logged-in user can access. The project linked to the current directory is marked.
|
|
examples:
|
|
- id: example-1
|
|
name: List all projects
|
|
code: supabase projects list
|
|
- id: example-2
|
|
name: Machine-readable JSON output
|
|
code: supabase projects list --output-format json
|
|
tags: []
|
|
links: []
|
|
usage: supabase projects list [flags]
|
|
subcommands: []
|
|
flags: []
|
|
- id: supabase-pull
|
|
title: supabase pull
|
|
summary: Pull remote project state locally
|
|
description: |
|
|
|
|
|
|
Refreshes your local project from a linked Supabase project or branch in one step, instead of running `config pull`, `db pull`, `migration fetch`, and `functions download` separately. Use it to sync a checkout with what is deployed.
|
|
|
|
It runs four steps in a fixed order: pull the config into `supabase/config.toml`, optionally fetch the remote migration history into `supabase/migrations`, pull the database schema into `supabase/migrations`, and download every Edge Function's source into `supabase/functions`. The order matters because the database step depends on `db.major_version` in the config and on the local migration history.
|
|
|
|
**This command is not purely a local refresh.** Pulling the database schema also updates that database's migration history table on the **remote** project, as `db pull` does.
|
|
|
|
## Target
|
|
|
|
Pass `--remote=<ref|branch>` to pull from a specific project, or from the name or UUID of a branch of the linked project. Values that are exactly 20 lowercase letters are always treated as project refs. Without it, the linked project is the target. `--project-ref` still works in v3 but is deprecated and removed in v4.
|
|
|
|
`--remote-label` overrides the `[remotes.*]` block the config step would otherwise reuse or create for that target, as in `config pull`.
|
|
|
|
## Migration history
|
|
|
|
On a fresh checkout, the migration history step runs automatically whenever `supabase/migrations` is missing or has no entries at all. A directory holding only a `.gitkeep` or `README.md` counts as non-empty. This is the same check `migration fetch` uses, and it lets the database step run without failing on an empty local directory.
|
|
|
|
Pass `--with-migration-history` to fetch again when the directory already has files. This overwrites any local migration file that shares a name with a remote history entry.
|
|
|
|
## Confirmation
|
|
|
|
The command prints the resolved target once (`Target: ...` on stderr), then asks for one confirmation before writing anything. The prompt lists the four steps, including a real config diff (or "No config differences found.") and a note that the database step requires Docker. `--dry-run` prints this same disclosure and exits without writing or changing anything.
|
|
|
|
Because the database step records the migration in the remote history table, the prompt defaults to **No**. Declining exits non-zero with `context canceled`. `--yes`, or `SUPABASE_YES` set in the shell environment, confirms it; a `SUPABASE_YES` in `supabase/.env` does not. `--output-format json|stream-json` and non-interactive runs cannot prompt, so they need `--yes`; an answer piped to stdin is ignored.
|
|
|
|
`--yes` also lets the database connection remove a network ban that blocks the temporary login role. Without it, the step fails and suggests re-running with `--yes` or running `supabase network-bans remove --remote=<ref>`.
|
|
|
|
## Uncommitted changes
|
|
|
|
Before writing, the command checks git for uncommitted or untracked changes in `supabase/config.toml` (or `config.json`), `supabase/migrations`, and `supabase/functions`. The config check only applies when the config step has something to write; the other two apply on every run. The confirmation and any abort message name exactly which paths are dirty.
|
|
|
|
`--force` writes even when a path is dirty. Without it, an interactive run shows a warning in the prompt, and every other run (non-interactive, machine output, or `--yes`) aborts rather than overwrite local edits.
|
|
|
|
## Docker and limits
|
|
|
|
The database step needs Docker, because it runs a shadow Postgres container and, on the first pull, a `pg_dump` container. Without Docker that step fails and is reported, but the config, migration history, and functions steps still complete.
|
|
|
|
If the database already matches the local migrations, the step reports `unchanged`. Running `supabase db pull` directly treats that case as an error.
|
|
|
|
Storage bucket definitions are not pulled, because the Management API doesn't return enough detail to populate `storage.buckets` faithfully.
|
|
|
|
## Example
|
|
|
|
```sh
|
|
supabase pull
|
|
```
|
|
|
|
Pulls config, database schema, and functions from the linked project, fetching migration history first if `supabase/migrations` is empty.
|
|
|
|
```sh
|
|
supabase pull --remote=staging
|
|
```
|
|
|
|
Pulls from the `staging` branch of the linked project.
|
|
|
|
```sh
|
|
supabase pull --dry-run
|
|
```
|
|
|
|
Prints the full confirmation body — the target header, the real config diff (or "No config differences found."), the migration-history/database/functions lines (including the Docker mention and, if applicable, the uncommitted-changes warning) — without writing or changing anything.
|
|
|
|
```sh
|
|
supabase pull --remote-label staging
|
|
```
|
|
|
|
Pulls into the `[remotes.staging]` block instead of whatever block the target would otherwise reuse or create.
|
|
|
|
Machine-readable output is available through `--output-format json|stream-json` — a single object (`schema_version`, `target`, `dry_run`, `confirmed`, `wrote`, `step_order`, `steps`, `counts`) with one entry per step under `steps`, keyed `config`, `migration_history`, `db`, and `functions`, each carrying its own `status` (`changed`, `unchanged`, `skipped`, `planned`, or `failed`), the paths it wrote, and a step-specific `detail` object. `target` carries `kind: "linked"`, `project_ref`, `environment` (`production`, `branch`, or `unverified`), `project_name` and `parent_project_ref` when known, and `branch` when `--remote` named one. The legacy global `-o`/`--output` flag is not supported by this command; use `--output-format json|stream-json` instead.
|
|
examples:
|
|
- id: example-1
|
|
name: Pull config, schema, and functions from the linked project
|
|
code: supabase pull
|
|
- id: example-2
|
|
name: Pull from the 'staging' branch of the linked project
|
|
code: supabase pull --remote=staging
|
|
- id: example-3
|
|
name: Preview what would be pulled without writing anything
|
|
code: supabase pull --dry-run
|
|
tags:
|
|
- other-commands
|
|
links: []
|
|
usage: supabase pull [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: dry-run
|
|
name: --dry-run
|
|
description: Show what would be pulled without writing or changing anything.
|
|
default_value: 'false'
|
|
- id: force
|
|
name: --force
|
|
description: Write even when the project config file, supabase/migrations, or supabase/functions has uncommitted or untracked changes in git.
|
|
default_value: 'false'
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: remote-label
|
|
name: --remote-label <string>
|
|
description: Name of the [remotes.*] block the config step writes into.
|
|
default_value: ''
|
|
- id: with-migration-history
|
|
name: --with-migration-history
|
|
description: Fetch the remote migration history into supabase/migrations even when it already has files.
|
|
default_value: 'false'
|
|
- id: supabase-secrets
|
|
title: supabase secrets
|
|
summary: Manage Edge Function secrets
|
|
description: |
|
|
|
|
|
|
Set, unset and list the secrets that your Edge Functions read as environment variables. Use them for environment-specific configuration and sensitive credentials. You can set secrets individually or load them from a `.env` file.
|
|
|
|
`secrets set` and `secrets unset` print the `Target:` line and then ask for confirmation before changing anything. The default answer is no, and the question lists the secret names, never their values.
|
|
|
|
Piped answers are never read, so scripts, JSON runs and agents must pass `--yes` or set `SUPABASE_YES` in the shell. A `SUPABASE_YES` in `supabase/.env` does not count.
|
|
|
|
`secrets unset --dry-run` and `secrets list` only read and never ask.
|
|
tags:
|
|
- management-api
|
|
links: []
|
|
subcommands:
|
|
- supabase-secrets-list
|
|
- supabase-secrets-set
|
|
- supabase-secrets-unset
|
|
flags: []
|
|
- id: supabase-secrets-list
|
|
title: supabase secrets list
|
|
summary: List secrets on the linked project
|
|
description: Show the names and digests of the secrets set on the linked project. Secret values are never shown.
|
|
examples:
|
|
- id: example-1
|
|
name: List all secrets for the linked project
|
|
code: supabase secrets list
|
|
- id: example-2
|
|
name: List secrets for a specific project
|
|
code: supabase secrets list --remote=abcdefghijklmnopqrst
|
|
tags: []
|
|
links: []
|
|
usage: supabase secrets list [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: supabase-secrets-set
|
|
title: supabase secrets set
|
|
summary: Set secrets on the linked project
|
|
description: |-
|
|
Set one or more secrets on the linked project, from `NAME=VALUE` pairs or a `.env` file. Edge Functions read them as environment variables.
|
|
|
|
The confirmation lists the secret names, never their values. Pass `--yes` in scripts and CI.
|
|
examples:
|
|
- id: example-1
|
|
name: Set a secret by name and value
|
|
code: supabase secrets set MY_SECRET=myvalue
|
|
- id: example-2
|
|
name: Set secrets from a .env file
|
|
code: supabase secrets set --env-file .env
|
|
tags: []
|
|
links: []
|
|
usage: supabase secrets set <NAME=VALUE> ... [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: env-file
|
|
name: --env-file <string>
|
|
description: Read secrets from a .env file.
|
|
default_value: ''
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: supabase-secrets-unset
|
|
title: supabase secrets unset
|
|
summary: Unset secrets on the linked project
|
|
description: |-
|
|
Remove one or more secrets from the linked project by name, or every custom secret with `--all`. Use `--dry-run` to preview what would be removed.
|
|
|
|
Asks for confirmation before changing anything; pass `--yes` in scripts and CI.
|
|
examples:
|
|
- id: example-1
|
|
name: Unset a secret by name
|
|
code: supabase secrets unset MY_SECRET
|
|
- id: example-2
|
|
name: Unset multiple secrets
|
|
code: supabase secrets unset MY_SECRET OTHER_SECRET
|
|
- id: example-3
|
|
name: Unset every custom secret after confirming
|
|
code: supabase secrets unset --all
|
|
- id: example-4
|
|
name: Preview which secrets --all would unset
|
|
code: supabase secrets unset --all --dry-run
|
|
tags: []
|
|
links: []
|
|
usage: supabase secrets unset [NAME] ... [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: all
|
|
name: --all
|
|
description: Unset every secret except those prefixed with SUPABASE_; required when no names are given.
|
|
default_value: 'false'
|
|
- id: dry-run
|
|
name: --dry-run
|
|
description: Print the secrets that would be unset without unsetting them.
|
|
default_value: 'false'
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: supabase-seed
|
|
title: supabase seed
|
|
summary: Seed a project from its config file
|
|
description: Populate a local or hosted project with the data described in the project config file.
|
|
tags:
|
|
- local-dev
|
|
links: []
|
|
subcommands:
|
|
- supabase-seed-buckets
|
|
flags: []
|
|
- id: supabase-seed-buckets
|
|
title: supabase seed buckets
|
|
summary: Seed Storage buckets from the project config file
|
|
description: Create or update the Storage buckets declared in the project config file and upload the files from each bucket's objects_path. A remote project asks for confirmation before the first write.
|
|
examples:
|
|
- id: example-1
|
|
name: Seed buckets on the local stack
|
|
code: supabase seed buckets
|
|
- id: example-2
|
|
name: Seed buckets on the linked project
|
|
code: supabase seed buckets --remote
|
|
tags: []
|
|
links: []
|
|
usage: supabase seed buckets [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target a remote Storage API: the linked project, or --remote=<ref|branch>.'
|
|
default_value: 'false'
|
|
- id: supabase-services
|
|
title: supabase services
|
|
summary: Show Supabase service versions
|
|
description: Show the version of each Supabase service in your local stack and, when the project is linked, the version running on the hosted project. Use it to spot a local stack that lags behind.
|
|
examples:
|
|
- id: example-1
|
|
name: Show local and linked service versions
|
|
code: supabase services
|
|
tags:
|
|
- local-dev
|
|
links: []
|
|
usage: supabase services [flags]
|
|
subcommands: []
|
|
flags: []
|
|
- id: supabase-snippets
|
|
title: supabase snippets
|
|
summary: Manage SQL snippets
|
|
description: List and download the SQL snippets saved in a project.
|
|
tags:
|
|
- management-api
|
|
links: []
|
|
subcommands:
|
|
- supabase-snippets-download
|
|
- supabase-snippets-list
|
|
flags: []
|
|
- id: supabase-snippets-download
|
|
title: supabase snippets download
|
|
summary: Download a SQL snippet
|
|
description: Print the SQL of a snippet to stdout, so you can redirect it to a file. JSON output returns the full snippet payload instead.
|
|
examples:
|
|
- id: example-1
|
|
name: Download the SQL contents of the given snippet
|
|
code: supabase snippets download <snippet-id>
|
|
tags: []
|
|
links: []
|
|
usage: supabase snippets download <snippet-id> [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: supabase-snippets-list
|
|
title: supabase snippets list
|
|
summary: List all SQL snippets
|
|
description: Show the SQL snippets of the linked project. Use it to find the ID that `snippets download` needs.
|
|
examples:
|
|
- id: example-1
|
|
name: List all SQL snippets
|
|
code: supabase snippets list
|
|
- id: example-2
|
|
name: List snippets for a specific project
|
|
code: supabase snippets list --remote=<ref>
|
|
tags: []
|
|
links: []
|
|
usage: supabase snippets list [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: supabase-ssl-enforcement
|
|
title: supabase ssl-enforcement
|
|
summary: Manage SSL enforcement
|
|
description: Control whether your project's database rejects connections that do not use SSL.
|
|
tags:
|
|
- management-api
|
|
links: []
|
|
subcommands:
|
|
- supabase-ssl-enforcement-get
|
|
- supabase-ssl-enforcement-update
|
|
flags: []
|
|
- id: supabase-ssl-enforcement-get
|
|
title: supabase ssl-enforcement get
|
|
summary: Get SSL enforcement configuration
|
|
description: Shows whether SSL enforcement is enabled for external database connections.
|
|
examples:
|
|
- id: example-1
|
|
name: Show the SSL enforcement setting of a project
|
|
code: supabase ssl-enforcement get --experimental --remote=<project-ref>
|
|
tags: []
|
|
links: []
|
|
usage: supabase ssl-enforcement get [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: experimental
|
|
name: --experimental
|
|
description: enable experimental features
|
|
required: true
|
|
default_value: 'false'
|
|
- id: supabase-ssl-enforcement-update
|
|
title: supabase ssl-enforcement update
|
|
summary: Update SSL enforcement configuration
|
|
description: Turns SSL enforcement on or off for external database connections. Pass exactly one of `--enable-db-ssl-enforcement` or `--disable-db-ssl-enforcement`.
|
|
examples:
|
|
- id: example-1
|
|
name: Require SSL for database connections
|
|
code: supabase ssl-enforcement update --enable-db-ssl-enforcement --experimental --remote=<project-ref>
|
|
- id: example-2
|
|
name: Stop requiring SSL for database connections
|
|
code: supabase ssl-enforcement update --disable-db-ssl-enforcement --experimental --remote=<project-ref>
|
|
tags: []
|
|
links: []
|
|
usage: supabase ssl-enforcement update [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: disable-db-ssl-enforcement
|
|
name: --disable-db-ssl-enforcement
|
|
description: Stop requiring SSL for external database connections.
|
|
default_value: 'false'
|
|
- id: enable-db-ssl-enforcement
|
|
name: --enable-db-ssl-enforcement
|
|
description: Require SSL for all external database connections.
|
|
default_value: 'false'
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: experimental
|
|
name: --experimental
|
|
description: enable experimental features
|
|
required: true
|
|
default_value: 'false'
|
|
- id: supabase-sso
|
|
title: supabase sso
|
|
summary: Manage Single Sign-On (SSO) authentication
|
|
description: Let users sign in to your project through your organization's SAML 2.0 identity provider.
|
|
tags:
|
|
- management-api
|
|
links: []
|
|
subcommands:
|
|
- supabase-sso-add
|
|
- supabase-sso-info
|
|
- supabase-sso-list
|
|
- supabase-sso-remove
|
|
- supabase-sso-show
|
|
- supabase-sso-update
|
|
flags: []
|
|
- id: supabase-sso-add
|
|
title: supabase sso add
|
|
summary: Add a new SSO identity provider
|
|
description: Connects a SAML 2.0 identity provider to your project. Provide its metadata with `--metadata-url` or `--metadata-file`.
|
|
examples:
|
|
- id: basic-usage
|
|
name: Add with Metadata URL
|
|
code: |-
|
|
supabase sso add \
|
|
--type saml \
|
|
--metadata-url 'https://...' \
|
|
--domains company.com \
|
|
--remote=abcdefghijklmnopqrst
|
|
response: |-
|
|
Information about the added identity provider. You can use
|
|
company.com as the domain name on the frontend side to initiate a SSO
|
|
request to the identity provider.
|
|
- id: with-xml
|
|
name: Add with Metadata File
|
|
code: |-
|
|
supabase sso add \
|
|
--type saml \
|
|
--metadata-file /path/to/metadata/file.xml \
|
|
--domains company.com \
|
|
--remote=abcdefghijklmnopqrst
|
|
response: |-
|
|
Information about the added identity provider. You can use
|
|
company.com as the domain name on the frontend side to initiate a SSO
|
|
request to the identity provider.
|
|
tags: []
|
|
links: []
|
|
usage: supabase sso add [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: attribute-mapping-file
|
|
name: --attribute-mapping-file <string>
|
|
description: Path to a JSON file mapping SAML attributes to custom JWT claims.
|
|
default_value: ''
|
|
- id: domains
|
|
name: --domains <strings>
|
|
description: Email domains to associate with the identity provider, comma-separated or repeated.
|
|
default_value: '[]'
|
|
- id: metadata-file
|
|
name: --metadata-file <string>
|
|
description: Path to a SAML 2.0 Metadata XML file describing the identity provider.
|
|
default_value: ''
|
|
- id: metadata-url
|
|
name: --metadata-url <string>
|
|
description: URL of a SAML 2.0 Metadata XML document describing the identity provider.
|
|
default_value: ''
|
|
- id: name-id-format
|
|
name: --name-id-format <string>
|
|
description: SAML name ID format URI used to identify users.
|
|
default_value: ''
|
|
accepted_values:
|
|
- id: urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress
|
|
name: urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress
|
|
type: string
|
|
- id: urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified
|
|
name: urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified
|
|
type: string
|
|
- id: urn:oasis:names:tc:SAML:2.0:nameid-format:persistent
|
|
name: urn:oasis:names:tc:SAML:2.0:nameid-format:persistent
|
|
type: string
|
|
- id: urn:oasis:names:tc:SAML:2.0:nameid-format:transient
|
|
name: urn:oasis:names:tc:SAML:2.0:nameid-format:transient
|
|
type: string
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: skip-url-validation
|
|
name: --skip-url-validation
|
|
description: Skip local validation of the metadata URL, such as in CI where the identity provider is unreachable.
|
|
default_value: 'false'
|
|
- id: type
|
|
name: -t, --type <[ saml ]>
|
|
description: Type of identity provider, based on its protocol.
|
|
required: true
|
|
default_value: ''
|
|
accepted_values:
|
|
- id: saml
|
|
name: saml
|
|
type: '[ saml ]'
|
|
- id: supabase-sso-info
|
|
title: supabase sso info
|
|
summary: Returns the SAML SSO settings required for the identity provider
|
|
description: Shows the values your identity provider needs to register your project, such as the ACS URL and the SP Entity ID.
|
|
examples:
|
|
- id: basic-usage
|
|
name: Show project information
|
|
code: supabase sso info --remote=abcdefghijklmnopqrst
|
|
response: Information about your project's SAML 2.0 configuration.
|
|
tags: []
|
|
links: []
|
|
usage: supabase sso info [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: supabase-sso-list
|
|
title: supabase sso list
|
|
summary: List all SSO identity providers
|
|
description: Shows the identity providers connected to your project, with their IDs and email domains.
|
|
examples:
|
|
- id: example-1
|
|
name: List all SSO providers for a project
|
|
code: supabase sso list --remote=mwjylndxudmiehsxhmmz
|
|
tags: []
|
|
links: []
|
|
usage: supabase sso list [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: supabase-sso-remove
|
|
title: supabase sso remove
|
|
summary: Remove an existing SSO identity provider
|
|
description: Disconnects an identity provider from your project. Existing users of that provider can no longer sign in, so use it with care.
|
|
examples:
|
|
- id: basic-usage
|
|
name: Remove a provider
|
|
code: |-
|
|
supabase sso remove 6df4d73f-bf21-405f-a084-b11adf19fea5 \
|
|
--remote=abcdefghijklmnopqrst
|
|
response: |-
|
|
Information about the removed identity provider. It's a good idea to
|
|
save this in case you need it later on.
|
|
tags: []
|
|
links: []
|
|
usage: supabase sso remove <provider-id> [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: supabase-sso-show
|
|
title: supabase sso show
|
|
summary: Show information about an SSO identity provider
|
|
description: Shows the settings of a connected identity provider. Use `--metadata` to print the raw SAML 2.0 Metadata XML stored in your project instead.
|
|
examples:
|
|
- id: basic-usage
|
|
name: Show information
|
|
code: |-
|
|
supabase sso show 6df4d73f-bf21-405f-a084-b11adf19fea5 \
|
|
--remote=abcdefghijklmnopqrst
|
|
response: Information about the identity provider in pretty output.
|
|
- id: metadata-output
|
|
name: Get raw SAML 2.0 Metadata XML
|
|
code: |-
|
|
supabase sso show 6df4d73f-bf21-405f-a084-b11adf19fea5 \
|
|
--metadata \
|
|
--remote=abcdefghijklmnopqrst
|
|
response: |-
|
|
Raw SAML 2.0 XML assigned to this identity provider. This is the
|
|
version used in the authentication project, and if using a SAML 2.0
|
|
Metadata URL it may change depending on the caching information
|
|
contained within the metadata.
|
|
tags: []
|
|
links: []
|
|
usage: supabase sso show <provider-id> [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: metadata
|
|
name: --metadata
|
|
description: Print only the SAML 2.0 Metadata XML.
|
|
default_value: 'false'
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: supabase-sso-update
|
|
title: supabase sso update
|
|
summary: Update information about an SSO identity provider
|
|
description: Changes the email domains, metadata, attribute mapping or name ID format of a connected identity provider.
|
|
examples:
|
|
- id: basic-usage
|
|
name: Replace domains
|
|
code: |-
|
|
supabase sso update 6df4d73f-bf21-405f-a084-b11adf19fea5 \
|
|
--domains new-company.com,new-company.net \
|
|
--remote=abcdefghijklmnopqrst
|
|
response: Information about the updated provider.
|
|
- id: add-domains
|
|
name: Add an additional domain
|
|
code: |-
|
|
supabase sso update 6df4d73f-bf21-405f-a084-b11adf19fea5 \
|
|
--add-domains company.net \
|
|
--remote=abcdefghijklmnopqrst
|
|
response: Information about the updated provider.
|
|
- id: remove-domains
|
|
name: Remove a domain
|
|
code: |-
|
|
supabase sso update 6df4d73f-bf21-405f-a084-b11adf19fea5 \
|
|
--remove-domains company.org \
|
|
--remote=abcdefghijklmnopqrst
|
|
response: Information about the updated provider.
|
|
tags: []
|
|
links: []
|
|
usage: supabase sso update <provider-id> [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: add-domains
|
|
name: --add-domains <strings>
|
|
description: Email domains to add to the identity provider, comma-separated or repeated.
|
|
default_value: '[]'
|
|
- id: attribute-mapping-file
|
|
name: --attribute-mapping-file <string>
|
|
description: Path to a JSON file mapping SAML attributes to custom JWT claims.
|
|
default_value: ''
|
|
- id: domains
|
|
name: --domains <strings>
|
|
description: Email domains that replace the current list, comma-separated or repeated.
|
|
default_value: '[]'
|
|
- id: metadata-file
|
|
name: --metadata-file <string>
|
|
description: Path to a SAML 2.0 Metadata XML file describing the identity provider.
|
|
default_value: ''
|
|
- id: metadata-url
|
|
name: --metadata-url <string>
|
|
description: URL of a SAML 2.0 Metadata XML document describing the identity provider.
|
|
default_value: ''
|
|
- id: name-id-format
|
|
name: --name-id-format <string>
|
|
description: SAML name ID format URI used to identify users.
|
|
default_value: ''
|
|
accepted_values:
|
|
- id: urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress
|
|
name: urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress
|
|
type: string
|
|
- id: urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified
|
|
name: urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified
|
|
type: string
|
|
- id: urn:oasis:names:tc:SAML:2.0:nameid-format:persistent
|
|
name: urn:oasis:names:tc:SAML:2.0:nameid-format:persistent
|
|
type: string
|
|
- id: urn:oasis:names:tc:SAML:2.0:nameid-format:transient
|
|
name: urn:oasis:names:tc:SAML:2.0:nameid-format:transient
|
|
type: string
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: remove-domains
|
|
name: --remove-domains <strings>
|
|
description: Email domains to remove from the identity provider, comma-separated or repeated.
|
|
default_value: '[]'
|
|
- id: skip-url-validation
|
|
name: --skip-url-validation
|
|
description: Skip local validation of the metadata URL, such as in CI where the identity provider is unreachable.
|
|
default_value: 'false'
|
|
- id: supabase-start
|
|
title: supabase start
|
|
summary: Start the local Supabase stack
|
|
description: |
|
|
|
|
|
|
Runs the Supabase local development stack (Postgres, Auth, Storage, Studio, and more) in Docker. Requires a `supabase/config.toml`, which `supabase init` creates.
|
|
|
|
All service containers start by default. Skip the ones you don't need with `-x`, either as a comma-separated list such as `-x gotrue,imgproxy` or by repeating the flag.
|
|
|
|
> Starting all services needs at least 7GB of RAM.
|
|
|
|
The CLI health-checks the started containers. Pass `--ignore-health-check` to continue past unhealthy services.
|
|
|
|
> If the CLI runs inside a dev container with the Docker socket bind-mounted, set `SUPABASE_SERVICES_HOSTNAME` to a hostname reachable from inside that container, such as `host.docker.internal`.
|
|
examples:
|
|
- id: basic-usage
|
|
name: Basic usage
|
|
code: supabase start
|
|
response: |
|
|
Creating custom roles supabase/roles.sql...
|
|
Applying migration 20220810154536_employee.sql...
|
|
Seeding data supabase/seed.sql...
|
|
Started supabase local development setup.
|
|
- id: without-studio
|
|
name: Start containers without studio and imgproxy
|
|
code: supabase start -x studio,imgproxy
|
|
response: |
|
|
Excluding container: supabase/studio:20221214-4eecc99
|
|
Excluding container: darthsim/imgproxy:v3.8.0
|
|
Started supabase local development setup.
|
|
- id: ignore-health-check
|
|
name: Ignore service health checks
|
|
code: supabase start --ignore-health-check
|
|
response: |
|
|
service not healthy: [supabase_storage_cli]
|
|
Started supabase local development setup.
|
|
tags:
|
|
- local-dev
|
|
links: []
|
|
usage: supabase start [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: exclude
|
|
name: -x, --exclude <strings>
|
|
description: Containers to skip, as repeated flags or a comma-separated list. [gotrue,realtime,storage-api,imgproxy,kong,mailpit,postgrest,postgres-meta,studio,edge-runtime,logflare,vector,supavisor]
|
|
default_value: '[]'
|
|
- id: ignore-health-check
|
|
name: --ignore-health-check
|
|
description: Ignore unhealthy services and exit 0.
|
|
default_value: 'false'
|
|
- id: supabase-status
|
|
title: supabase status
|
|
summary: Show the local Supabase stack status
|
|
description: |
|
|
|
|
|
|
Prints the URLs, keys, and database connection string of the running local stack. The stack must already be running, started with `supabase start` or `supabase db start`.
|
|
|
|
To export the connection parameters for [initializing supabase-js](https://supabase.com/docs/reference/javascript/initializing) locally, pass `-o env`. The output includes `JWT_SECRET`, `ANON_KEY`, and `SERVICE_ROLE_KEY`.
|
|
examples:
|
|
- id: basic-usage
|
|
name: Basic usage
|
|
code: supabase status
|
|
response: |
|
|
supabase local development setup is running.
|
|
|
|
API URL: http://127.0.0.1:54321
|
|
GraphQL URL: http://127.0.0.1:54321/graphql/v1
|
|
DB URL: postgresql://postgres:postgres@127.0.0.1:54322/postgres
|
|
Studio URL: http://127.0.0.1:54323
|
|
Mailpit URL: http://127.0.0.1:54324
|
|
JWT secret: super-secret-jwt-token-with-at-least-32-characters-long
|
|
anon key: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0
|
|
service_role key: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MzgxMjk5Nn0.EGIM96RAZx35lJzdJsyH-qQwv8Hdp7fsn3W0YpN81IU
|
|
- id: output-env
|
|
name: Format status as environment variables
|
|
code: supabase status -o env
|
|
response: |
|
|
ANON_KEY="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0"
|
|
API_URL="http://127.0.0.1:54321"
|
|
DB_URL="postgresql://postgres:postgres@127.0.0.1:54322/postgres"
|
|
GRAPHQL_URL="http://127.0.0.1:54321/graphql/v1"
|
|
JWT_SECRET="super-secret-jwt-token-with-at-least-32-characters-long"
|
|
SERVICE_ROLE_KEY="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MzgxMjk5Nn0.EGIM96RAZx35lJzdJsyH-qQwv8Hdp7fsn3W0YpN81IU"
|
|
STUDIO_URL="http://127.0.0.1:54323"
|
|
- id: output-custom-name
|
|
name: Customize the names of exported variables
|
|
code: supabase status -o env --override-name auth.anon_key=SUPABASE_ANON_KEY --override-name auth.service_role_key=SUPABASE_SERVICE_KEY
|
|
response: |
|
|
Stopped services: [supabase_inbucket_cli supabase_rest_cli supabase_studio_cli]
|
|
SUPABASE_ANON_KEY="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0"
|
|
DB_URL="postgresql://postgres:postgres@127.0.0.1:54322/postgres"
|
|
GRAPHQL_URL="http://127.0.0.1:54321/graphql/v1"
|
|
JWT_SECRET="super-secret-jwt-token-with-at-least-32-characters-long"
|
|
SUPABASE_SERVICE_KEY="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6InNlcnZpY2Vfcm9sZSIsImV4cCI6MTk4MzgxMjk5Nn0.EGIM96RAZx35lJzdJsyH-qQwv8Hdp7fsn3W0YpN81IU"
|
|
tags:
|
|
- local-dev
|
|
links: []
|
|
usage: supabase status [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: override-name
|
|
name: --override-name <strings>
|
|
description: Rename an exported variable, as key=NAME pairs or a comma-separated list.
|
|
default_value: '[]'
|
|
- id: supabase-stop
|
|
title: supabase stop
|
|
summary: Stop the local Supabase stack
|
|
description: |
|
|
|
|
|
|
Stops the containers of the local development stack. Requires a `supabase/config.toml`, which `supabase init` creates.
|
|
|
|
Docker volumes are kept, so your data survives a restart. Pass `--no-backup` to delete them and reset your local data.
|
|
|
|
Pass `--all` to stop every local Supabase project on the machine. Take care combining it with `--no-backup`, which deletes the data of all of them.
|
|
examples:
|
|
- id: basic-usage
|
|
name: Basic usage
|
|
code: supabase stop
|
|
response: |
|
|
Stopped supabase local development setup.
|
|
Local data are backed up to docker volume.
|
|
- id: clean-up
|
|
name: Clean up local data after stopping
|
|
code: supabase stop --no-backup
|
|
response: |
|
|
Stopped supabase local development setup.
|
|
tags:
|
|
- local-dev
|
|
links: []
|
|
usage: supabase stop [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: all
|
|
name: --all
|
|
description: Stop the local Supabase stacks of every project on this machine.
|
|
default_value: 'false'
|
|
- id: no-backup
|
|
name: --no-backup
|
|
description: Delete all data volumes after stopping.
|
|
default_value: 'false'
|
|
- id: project-id
|
|
name: --project-id <string>
|
|
description: Local project ID to stop.
|
|
default_value: ''
|
|
- id: supabase-storage
|
|
title: supabase storage
|
|
summary: Manage Storage objects
|
|
description: |-
|
|
List, copy, move and remove objects in Storage buckets using `ss:///bucket/path` URLs.
|
|
|
|
These commands are experimental and require the `--experimental` flag.
|
|
tags:
|
|
- management-api
|
|
links: []
|
|
subcommands:
|
|
- supabase-storage-cp
|
|
- supabase-storage-ls
|
|
- supabase-storage-mv
|
|
- supabase-storage-rm
|
|
flags: []
|
|
- id: supabase-storage-cp
|
|
title: supabase storage cp
|
|
summary: Copy files between local disk and Storage
|
|
description: |-
|
|
Upload local files to Storage, or download objects from Storage to local disk. Exactly one side must be a `ss:///bucket/path` URL; copying between buckets is not supported.
|
|
|
|
Requires the `--experimental` flag.
|
|
examples:
|
|
- id: example-1
|
|
name: Upload a local file to storage
|
|
code: supabase storage cp readme.md ss:///bucket/readme.md
|
|
- id: example-2
|
|
name: Upload a directory recursively to storage
|
|
code: supabase storage cp -r docs ss:///bucket/docs
|
|
- id: example-3
|
|
name: Download a directory from storage
|
|
code: supabase storage cp -r ss:///bucket/docs .
|
|
tags: []
|
|
links: []
|
|
usage: supabase storage cp <src> <dst> [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: cache-control
|
|
name: --cache-control <string>
|
|
description: Custom Cache-Control header for HTTP upload.
|
|
default_value: max-age=3600
|
|
- id: content-type
|
|
name: --content-type <string>
|
|
description: Custom Content-Type header for HTTP upload.
|
|
default_value: auto-detect
|
|
- id: jobs
|
|
name: -j, --jobs <integer>
|
|
description: Maximum number of parallel jobs.
|
|
default_value: '1'
|
|
- id: recursive
|
|
name: -r, --recursive
|
|
description: Recursively copy a directory.
|
|
default_value: 'false'
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target a remote Storage API: the linked project, or --remote=<ref|branch>.'
|
|
default_value: 'false'
|
|
- id: experimental
|
|
name: --experimental
|
|
description: enable experimental features
|
|
required: true
|
|
default_value: 'false'
|
|
- id: supabase-storage-ls
|
|
title: supabase storage ls
|
|
summary: List objects by path prefix
|
|
description: |-
|
|
List the objects under a Storage path such as `ss:///bucket/docs`. Without a path, it lists all buckets.
|
|
|
|
Requires the `--experimental` flag.
|
|
examples:
|
|
- id: example-1
|
|
name: List objects at a storage path
|
|
code: supabase storage ls ss:///bucket/docs
|
|
tags: []
|
|
links: []
|
|
usage: supabase storage ls [path] [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: recursive
|
|
name: -r, --recursive
|
|
description: Recursively list a directory.
|
|
default_value: 'false'
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target a remote Storage API: the linked project, or --remote=<ref|branch>.'
|
|
default_value: 'false'
|
|
- id: experimental
|
|
name: --experimental
|
|
description: enable experimental features
|
|
required: true
|
|
default_value: 'false'
|
|
- id: supabase-storage-mv
|
|
title: supabase storage mv
|
|
summary: Move objects within a Storage bucket
|
|
description: |-
|
|
Move or rename objects within a Storage bucket; moving between buckets is not supported.
|
|
|
|
The command asks for confirmation before changing anything. Requires the `--experimental` flag.
|
|
examples:
|
|
- id: example-1
|
|
name: Recursively move a directory within storage
|
|
code: supabase storage mv -r ss:///bucket/docs ss:///bucket/www/docs
|
|
tags: []
|
|
links: []
|
|
usage: supabase storage mv <src> <dst> [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: recursive
|
|
name: -r, --recursive
|
|
description: Recursively move a directory.
|
|
default_value: 'false'
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target a remote Storage API: the linked project, or --remote=<ref|branch>.'
|
|
default_value: 'false'
|
|
- id: experimental
|
|
name: --experimental
|
|
description: enable experimental features
|
|
required: true
|
|
default_value: 'false'
|
|
- id: supabase-storage-rm
|
|
title: supabase storage rm
|
|
summary: Remove objects from Storage
|
|
description: |-
|
|
Remove one or more objects from Storage. Pass `-r` to remove directories.
|
|
|
|
The command asks for confirmation before deleting. Requires the `--experimental` flag.
|
|
examples:
|
|
- id: example-1
|
|
name: Recursively remove a directory from storage
|
|
code: supabase storage rm -r ss:///bucket/docs
|
|
- id: example-2
|
|
name: Remove multiple files from storage
|
|
code: supabase storage rm ss:///bucket/docs/example.md ss:///bucket/readme.md
|
|
tags: []
|
|
links: []
|
|
usage: supabase storage rm <file> ... [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: recursive
|
|
name: -r, --recursive
|
|
description: Recursively remove a directory.
|
|
default_value: 'false'
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target a remote Storage API: the linked project, or --remote=<ref|branch>.'
|
|
default_value: 'false'
|
|
- id: experimental
|
|
name: --experimental
|
|
description: enable experimental features
|
|
required: true
|
|
default_value: 'false'
|
|
- id: supabase-telemetry
|
|
title: supabase telemetry
|
|
summary: Manage CLI telemetry
|
|
description: Turn anonymous CLI usage telemetry on or off, or check whether it is on.
|
|
tags:
|
|
- local-dev
|
|
links: []
|
|
subcommands:
|
|
- supabase-telemetry-disable
|
|
- supabase-telemetry-enable
|
|
- supabase-telemetry-status
|
|
flags: []
|
|
- id: supabase-telemetry-disable
|
|
title: supabase telemetry disable
|
|
summary: Disable CLI telemetry
|
|
description: Turn off anonymous CLI usage telemetry for this machine.
|
|
examples:
|
|
- id: example-1
|
|
name: Turn telemetry off
|
|
code: supabase telemetry disable
|
|
tags: []
|
|
links: []
|
|
usage: supabase telemetry disable [flags]
|
|
subcommands: []
|
|
flags: []
|
|
- id: supabase-telemetry-enable
|
|
title: supabase telemetry enable
|
|
summary: Enable CLI telemetry
|
|
description: Turn on anonymous CLI usage telemetry for this machine.
|
|
examples:
|
|
- id: example-1
|
|
name: Turn telemetry on
|
|
code: supabase telemetry enable
|
|
tags: []
|
|
links: []
|
|
usage: supabase telemetry enable [flags]
|
|
subcommands: []
|
|
flags: []
|
|
- id: supabase-telemetry-status
|
|
title: supabase telemetry status
|
|
summary: Show CLI telemetry status
|
|
description: Print whether CLI telemetry is currently enabled or disabled.
|
|
examples:
|
|
- id: example-1
|
|
name: Check whether telemetry is on
|
|
code: supabase telemetry status
|
|
tags: []
|
|
links: []
|
|
usage: supabase telemetry status [flags]
|
|
subcommands: []
|
|
flags: []
|
|
- id: supabase-test
|
|
title: supabase test
|
|
summary: Run database tests
|
|
description: Run pgTAP tests against your database and scaffold new test files in supabase/tests.
|
|
tags:
|
|
- local-dev
|
|
links: []
|
|
subcommands:
|
|
- supabase-test-db
|
|
- supabase-test-new
|
|
flags: []
|
|
- id: supabase-test-db
|
|
title: supabase test db
|
|
summary: Run database tests with pgTAP
|
|
description: |
|
|
|
|
|
|
Run pgTAP tests against a database. By default it runs the `.sql` and `.pg` test files in `supabase/tests`; pass paths to run specific files or directories.
|
|
|
|
It runs against the local database by default, which requires the local development stack to be started by running `supabase start`. Pass `--remote` for the linked project, or `--remote=<ref|branch|url>` for another project, a branch of the linked project, or a database URL. The command prints a `Target:` line on stderr naming the database it resolved.
|
|
|
|
`--linked`, `--project-ref`, `--db-url` and `--local` still work in v3 but are deprecated and removed in v4; use `--remote`.
|
|
|
|
Running the tests enables the pgTAP extension and drops it again afterwards. A hosted database (the linked project or a remote database URL) therefore asks for one confirmation (default No) before anything runs. Piped answers are never read, so a script, a JSON run or an agent must pass `--yes` or set `SUPABASE_YES` in the shell; a `SUPABASE_YES` in `supabase/.env` does not count. The local database never asks.
|
|
|
|
The tests run with `pg_prove` in a container that mounts your test directory. Each test is wrapped in its own transaction, which is rolled back whether the test passes or fails.
|
|
examples:
|
|
- id: basic-usage
|
|
name: Basic usage
|
|
code: supabase test db
|
|
response: |
|
|
/tmp/supabase/tests/nested/order_test.pg .. ok
|
|
/tmp/supabase/tests/pet_test.sql .......... ok
|
|
All tests successful.
|
|
Files=2, Tests=2, 6 wallclock secs ( 0.03 usr 0.01 sys + 0.05 cusr 0.02 csys = 0.11 CPU)
|
|
Result: PASS
|
|
tags: []
|
|
links: []
|
|
usage: supabase test db [path] ... [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch|url>]
|
|
description: 'Target a remote database: the linked project, or --remote=<ref|branch|url>.'
|
|
default_value: 'false'
|
|
- id: supabase-test-new
|
|
title: supabase test new
|
|
summary: Create a new test file
|
|
description: Create a test file in supabase/tests to start writing database tests from a template.
|
|
examples:
|
|
- id: example-1
|
|
name: Create a pgTAP test file
|
|
code: supabase test new users
|
|
tags: []
|
|
links: []
|
|
usage: supabase test new <name> [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: template
|
|
name: -t, --template <[ pgtap ]>
|
|
description: Test framework to generate the file for.
|
|
default_value: pgtap
|
|
accepted_values:
|
|
- id: pgtap
|
|
name: pgtap
|
|
type: '[ pgtap ]'
|
|
- id: supabase-unlink
|
|
title: supabase unlink
|
|
summary: Unlink from the hosted Supabase project
|
|
description: |-
|
|
Remove the link between the local project and its hosted Supabase project. Use it before linking to a different project.
|
|
|
|
The command deletes the local `supabase/.temp` directory and the stored database password for the linked project. Your access token is left untouched.
|
|
examples:
|
|
- id: example-1
|
|
name: Unlink the current directory from its hosted project
|
|
code: supabase unlink
|
|
tags:
|
|
- local-dev
|
|
links: []
|
|
usage: supabase unlink [flags]
|
|
subcommands: []
|
|
flags: []
|
|
- id: supabase-vanity-subdomains
|
|
title: supabase vanity-subdomains
|
|
summary: Manage vanity subdomains
|
|
description: |
|
|
|
|
|
|
Gives your project a branded hostname under the Supabase domain instead of the project ref. Vanity subdomains and custom domains are mutually exclusive.
|
|
|
|
`activate` and `delete` ask for confirmation, with a default of No. Pass `--yes` (or set `SUPABASE_YES` in the shell) to run without a prompt, which JSON output and non-interactive runs require.
|
|
tags:
|
|
- management-api
|
|
links: []
|
|
subcommands:
|
|
- supabase-vanity-subdomains-activate
|
|
- supabase-vanity-subdomains-check-availability
|
|
- supabase-vanity-subdomains-delete
|
|
- supabase-vanity-subdomains-get
|
|
flags: []
|
|
- id: supabase-vanity-subdomains-activate
|
|
title: supabase vanity-subdomains activate
|
|
summary: Activate a vanity subdomain
|
|
description: Makes your project respond to requests on the vanity subdomain you choose. After activation, your project's auth services no longer work on the `{project-ref}.{supabase-domain}` hostname.
|
|
examples:
|
|
- id: example-1
|
|
name: Activate a vanity subdomain for a project
|
|
code: supabase vanity-subdomains activate --desired-subdomain my-app --experimental --remote=<project-ref>
|
|
tags: []
|
|
links: []
|
|
usage: supabase vanity-subdomains activate [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: desired-subdomain
|
|
name: --desired-subdomain <string>
|
|
description: The vanity subdomain to use for the project.
|
|
required: true
|
|
default_value: ''
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: experimental
|
|
name: --experimental
|
|
description: enable experimental features
|
|
required: true
|
|
default_value: 'false'
|
|
- id: supabase-vanity-subdomains-check-availability
|
|
title: supabase vanity-subdomains check-availability
|
|
summary: Check subdomain availability
|
|
description: Tells you whether a subdomain is free to use. Run it before `supabase vanity-subdomains activate`.
|
|
examples:
|
|
- id: example-1
|
|
name: Check whether a subdomain is available
|
|
code: supabase vanity-subdomains check-availability --desired-subdomain my-app --experimental --remote=<project-ref>
|
|
tags: []
|
|
links: []
|
|
usage: supabase vanity-subdomains check-availability [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: desired-subdomain
|
|
name: --desired-subdomain <string>
|
|
description: The vanity subdomain to check.
|
|
required: true
|
|
default_value: ''
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: experimental
|
|
name: --experimental
|
|
description: enable experimental features
|
|
required: true
|
|
default_value: 'false'
|
|
- id: supabase-vanity-subdomains-delete
|
|
title: supabase vanity-subdomains delete
|
|
summary: Delete the vanity subdomain
|
|
description: Removes the vanity subdomain, so requests are routed by project ref again.
|
|
examples:
|
|
- id: example-1
|
|
name: Delete the vanity subdomain of a project
|
|
code: supabase vanity-subdomains delete --experimental --remote=<project-ref>
|
|
tags: []
|
|
links: []
|
|
usage: supabase vanity-subdomains delete [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: experimental
|
|
name: --experimental
|
|
description: enable experimental features
|
|
required: true
|
|
default_value: 'false'
|
|
- id: supabase-vanity-subdomains-get
|
|
title: supabase vanity-subdomains get
|
|
summary: Get the current vanity subdomain
|
|
description: Shows the vanity subdomain configured for your project, along with its status.
|
|
examples:
|
|
- id: example-1
|
|
name: Show the vanity subdomain of a project
|
|
code: supabase vanity-subdomains get --experimental --remote=<project-ref>
|
|
tags: []
|
|
links: []
|
|
usage: supabase vanity-subdomains get [flags]
|
|
subcommands: []
|
|
flags:
|
|
- id: remote
|
|
name: --remote[=<ref|branch>]
|
|
description: 'Target another project: --remote=<ref|branch>. Defaults to the linked project.'
|
|
default_value: 'false'
|
|
- id: experimental
|
|
name: --experimental
|
|
description: enable experimental features
|
|
required: true
|
|
default_value: 'false'
|
|
- id: supabase-whoami
|
|
title: supabase whoami
|
|
summary: Show the current user
|
|
description: Show information about the currently logged-in user.
|
|
examples:
|
|
- id: example-1
|
|
name: Show the current user
|
|
code: supabase whoami
|
|
- id: example-2
|
|
name: Show the current user as JSON
|
|
code: supabase whoami --output-format json
|
|
tags:
|
|
- management-api
|
|
links: []
|
|
usage: supabase whoami [flags]
|
|
subcommands: []
|
|
flags: []
|