mirror of
https://github.com/supabase/supabase.git
synced 2026-07-04 03:54:29 +08:00
1052 lines
13 KiB
Plaintext
1052 lines
13 KiB
Plaintext
---
|
|
id: usage
|
|
title: Usage
|
|
---
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
Supabase CLI
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## Stop the Supabase local development setup {#supabase-stop}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
```sh
|
|
supabase stop [flags]
|
|
```
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
-h, --help help for stop
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## Show status of the Supabase local development setup {#supabase-status}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
```sh
|
|
supabase status [flags]
|
|
```
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
-h, --help help for status
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## Start the Supabase local development setup {#supabase-start}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
```sh
|
|
supabase start [flags]
|
|
```
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
-h, --help help for start
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## Manage Supabase secrets {#supabase-secrets}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
|
|
|
|
|
|
### Available Commands
|
|
|
|
|
|
- <a href="#supabase-secrets-list">supabase-secrets-list</a>
|
|
|
|
- <a href="#supabase-secrets-set">supabase-secrets-set</a>
|
|
|
|
- <a href="#supabase-secrets-unset">supabase-secrets-unset</a>
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
-h, --help help for secrets
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## Unset a secret(s) from the linked Supabase project {#supabase-secrets-unset}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
```sh
|
|
supabase secrets unset <NAME> ... [flags]
|
|
```
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
-h, --help help for unset
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## Set a secret(s) to the linked Supabase project {#supabase-secrets-set}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
```sh
|
|
supabase secrets set [flags] <NAME=VALUE> ...
|
|
```
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
--env-file string Read secrets from a .env file.
|
|
-h, --help help for set
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## List all secrets in the linked project {#supabase-secrets-list}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
```sh
|
|
supabase secrets list [flags]
|
|
```
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
-h, --help help for list
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## Manage Supabase projects {#supabase-projects}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
|
|
|
|
|
|
### Available Commands
|
|
|
|
|
|
- <a href="#supabase-projects-create">supabase-projects-create</a>
|
|
|
|
- <a href="#supabase-projects-list">supabase-projects-list</a>
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
-h, --help help for projects
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## List all projects {#supabase-projects-list}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
```sh
|
|
supabase projects list [flags]
|
|
```
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
-h, --help help for list
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## Create a new project {#supabase-projects-create}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
```sh
|
|
supabase projects create [flags]
|
|
```
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
--db-password string Database password of the project.
|
|
-h, --help help for create
|
|
--org-id string Organization ID to create the project in.
|
|
--plan string Select a plan that suits your needs. Can be "free" or "pro". (default "free")
|
|
--region string Select a region close to you for the best performance.
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## Manage Supabase organizations {#supabase-orgs}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
|
|
|
|
|
|
### Available Commands
|
|
|
|
|
|
- <a href="#supabase-orgs-list">supabase-orgs-list</a>
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
-h, --help help for orgs
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## List all organizations the logged-in user belongs {#supabase-orgs-list}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
```sh
|
|
supabase orgs list [flags]
|
|
```
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
-h, --help help for list
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## Manage database migration scripts {#supabase-migration}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
|
|
|
|
|
|
### Available Commands
|
|
|
|
|
|
- <a href="#supabase-migration-new">supabase-migration-new</a>
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
-h, --help help for migration
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## Create an empty migration script {#supabase-migration-new}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
```sh
|
|
supabase migration new <migration name> [flags]
|
|
```
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
-h, --help help for new
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## Authenticate using an access token {#supabase-login}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
```sh
|
|
supabase login [flags]
|
|
```
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
-h, --help help for login
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## Link to a Supabase project {#supabase-link}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
```sh
|
|
supabase link [flags]
|
|
```
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
-h, --help help for link
|
|
--project-ref string Project ref of the Supabase project.
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## Initialize a project to use Supabase CLI {#supabase-init}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
```sh
|
|
supabase init [flags]
|
|
```
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
-h, --help help for init
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## Run code generation tools {#supabase-gen}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
|
|
|
|
|
|
### Available Commands
|
|
|
|
|
|
- <a href="#supabase-gen-types">supabase-gen-types</a>
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
-h, --help help for gen
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## Generate types from Postgres schema {#supabase-gen-types}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
|
|
|
|
|
|
### Available Commands
|
|
|
|
|
|
- <a href="#supabase-gen-types-typescript">supabase-gen-types-typescript</a>
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
-h, --help help for types
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## Generate types for TypeScript. Must specify either --local or --db-url
|
|
{#supabase-gen-types-typescript}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
```sh
|
|
supabase gen types typescript [flags]
|
|
```
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
--db-url string Generate types from a database url.
|
|
-h, --help help for typescript
|
|
--local Generate types from the local dev database.
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## Manage Supabase Edge functions {#supabase-functions}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
|
|
|
|
|
|
### Available Commands
|
|
|
|
|
|
- <a href="#supabase-functions-delete">supabase-functions-delete</a>
|
|
|
|
- <a href="#supabase-functions-deploy">supabase-functions-deploy</a>
|
|
|
|
- <a href="#supabase-functions-new">supabase-functions-new</a>
|
|
|
|
- <a href="#supabase-functions-serve">supabase-functions-serve</a>
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
-h, --help help for functions
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## Serve a Function locally {#supabase-functions-serve}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
```sh
|
|
supabase functions serve <Function name> [flags]
|
|
```
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
--env-file string Path to an env file to be populated to the Function environment.
|
|
-h, --help help for serve
|
|
--no-verify-jwt Disable JWT verification for the Function.
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## Create a new Function locally {#supabase-functions-new}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
```sh
|
|
supabase functions new <Function name> [flags]
|
|
```
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
-h, --help help for new
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## Deploy a Function to the linked Supabase project {#supabase-functions-deploy}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
```sh
|
|
supabase functions deploy <Function name> [flags]
|
|
```
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
-h, --help help for deploy
|
|
--no-verify-jwt Disable JWT verification for the Function.
|
|
--project-ref string Project ref of the Supabase project.
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## Delete a Function from the linked Supabase project. This does NOT remove the Function locally.
|
|
{#supabase-functions-delete}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
```sh
|
|
supabase functions delete <Function name> [flags]
|
|
```
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
-h, --help help for delete
|
|
--project-ref string Project ref of the Supabase project.
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## Manage Postgres databases {#supabase-db}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
|
|
|
|
|
|
### Available Commands
|
|
|
|
|
|
- <a href="#supabase-db-branch">supabase-db-branch</a>
|
|
|
|
- <a href="#supabase-db-diff">supabase-db-diff</a>
|
|
|
|
- <a href="#supabase-db-push">supabase-db-push</a>
|
|
|
|
- <a href="#supabase-db-remote">supabase-db-remote</a>
|
|
|
|
- <a href="#supabase-db-reset">supabase-db-reset</a>
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
-h, --help help for db
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## Resets the local database to current migrations {#supabase-db-reset}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
```sh
|
|
supabase db reset [flags]
|
|
```
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
-h, --help help for reset
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## Manage remote database connections {#supabase-db-remote}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
|
|
|
|
|
|
### Available Commands
|
|
|
|
|
|
- <a href="#supabase-db-remote-changes">supabase-db-remote-changes</a>
|
|
|
|
- <a href="#supabase-db-remote-commit">supabase-db-remote-commit</a>
|
|
|
|
- <a href="#supabase-db-remote-set">supabase-db-remote-set</a>
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
-h, --help help for remote
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## Set the remote database to push migrations to {#supabase-db-remote-set}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
```sh
|
|
supabase db remote set <remote database url> [flags]
|
|
```
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
-h, --help help for set
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## Commit changes on the remote database since the last pushed migration
|
|
{#supabase-db-remote-commit}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
```sh
|
|
supabase db remote commit [flags]
|
|
```
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
-h, --help help for commit
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## Print changes on the remote database since the last pushed migration
|
|
{#supabase-db-remote-changes}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
```sh
|
|
supabase db remote changes [flags]
|
|
```
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
-h, --help help for changes
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## Push new migrations to the remote database {#supabase-db-push}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
```sh
|
|
supabase db push [flags]
|
|
```
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
--dry-run Print the migrations that would be applied, but don't actually apply them.
|
|
-h, --help help for push
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## Diffs the local database for schema changes {#supabase-db-diff}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
```sh
|
|
supabase db diff [flags]
|
|
```
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
-f, --file string Saves schema diff to a file.
|
|
-h, --help help for diff
|
|
-s, --schema strings List of schema to include. (default [public])
|
|
--use-migra Use migra to generate schema diff.
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## Manage branches. Each branch is associated with a separate database.
|
|
{#supabase-db-branch}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
|
|
|
|
|
|
### Available Commands
|
|
|
|
|
|
- <a href="#supabase-db-branch-create">supabase-db-branch-create</a>
|
|
|
|
- <a href="#supabase-db-branch-delete">supabase-db-branch-delete</a>
|
|
|
|
- <a href="#supabase-db-branch-list">supabase-db-branch-list</a>
|
|
|
|
- <a href="#supabase-db-branch-switch">supabase-db-branch-switch</a>
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
-h, --help help for branch
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## Switch the active branch {#supabase-db-branch-switch}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
```sh
|
|
supabase db branch switch <branch name> [flags]
|
|
```
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
-h, --help help for switch
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## List branches {#supabase-db-branch-list}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
```sh
|
|
supabase db branch list [flags]
|
|
```
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
-h, --help help for list
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## Delete a branch {#supabase-db-branch-delete}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
```sh
|
|
supabase db branch delete <branch name> [flags]
|
|
```
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
-h, --help help for delete
|
|
```
|
|
|
|
|
|
|
|
<!-- AUTOGENERATED: DO NOT EDIT DIRECTLY IF THIS IS VERSION "next" -->
|
|
|
|
<br /><br />
|
|
|
|
## Create a branch {#supabase-db-branch-create}
|
|
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
```sh
|
|
supabase db branch create <branch name> [flags]
|
|
```
|
|
|
|
|
|
|
|
### Options
|
|
|
|
```sh
|
|
-h, --help help for create
|
|
```
|
|
|