Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

chore: update cli reference doc

Qiao Hanabc3162eab46
diff --git a/spec/cli_v1_commands.yaml b/spec/cli_v1_commands.yaml
index daf13552001..595ce8ff2d7 100644
--- a/spec/cli_v1_commands.yaml
+++ b/spec/cli_v1_commands.yaml
@@ -1,7 +1,7 @@
clispec: '001'
info:
id: cli
- version: 1.34.5
+ version: 1.42.0
title: Supabase CLI
language: sh
source: https://github.com/supabase/cli
@@ -21,6 +21,17 @@ flags:
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
@@ -155,6 +166,13 @@ commands:
- id: supabase-stop
title: supabase stop
summary: Stop all local Supabase containers
+ description: |2
+
+ Stops the Supabase local development stack.
+
+ Requires `supabase/config.toml` to be created in your current working directory by running `supabase init`.
+
+ All Docker resources are cleaned up by default. Use `--backup` flag to persist your local development data between restarts.
examples:
- id: basic-usage
name: Basic usage
@@ -165,7 +183,8 @@ commands:
name: Backup local database before stopping
code: supabase stop --backup
response: |
- Database exported to supabase/.branches/main
+ Postgres database saved to volume: supabase_db_cli
+ Storage directory saved to volume: supabase_storage_cli
Stopped supabase local development setup.
tags:
- local-dev
@@ -180,6 +199,13 @@ commands:
- id: supabase-status
title: supabase status
summary: Show status of local Supabase containers
+ description: |2
+
+ Shows status of the Supabase local development stack.
+
+ Requires the local development stack to be started by running `supabase start` or `supabase db start`.
+
+ You can export the connection parameters for [initializing supabase-js](https://supabase.com/docs/reference/javascript/initializing) locally by specifying the `-o env` flag. Supported parameters include `JWT_SECRET`, `ANON_KEY`, and `SERVICE_ROLE_KEY`.
examples:
- id: basic-usage
name: Basic usage
@@ -253,7 +279,9 @@ commands:
Requires `supabase/config.toml` to be created in your current working directory by running `supabase init`.
- All service containers are started by default. You can exclude those not needed by passing in `-x` flag.
+ All service containers are started by default. You can exclude those not needed by passing in `-x` flag. To exclude multiple containers, either pass in a comma separated string, such as `-x gotrue,imgproxy`, or specify `-x` flag multiple times.
+
+ > It is recommended to have at least 7GB of RAM to start all services.
Health checks are automatically added to verify the started containers. Use `--ignore-health-check` flag to ignore these errors.
examples:
@@ -265,10 +293,11 @@ commands:
Seeding data supabase/seed.sql...
Started supabase local development setup.
- id: without-studio
- name: Start containers without studio
- code: supabase start -x 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
Seeding data supabase/seed.sql...
Started supabase local development setup.
- id: ignore-health-check
@@ -287,12 +316,66 @@ commands:
- id: exclude
name: -x, --exclude <strings>
description: |
- Names of containers to not start. [gotrue, realtime, storage-api, imgproxy, kong, inbucket, postgrest, pgadmin-schema-diff, migra, postgres-meta, studio, deno-relay]
+ Names of containers to not start. [gotrue,realtime,storage-api,imgproxy,kong,inbucket,postgrest,pgadmin-schema-diff,migra,postgres-meta,studio,deno-relay]
default_value: '[]'
- id: ignore-health-check
name: --ignore-health-check
description: Ignore unhealthy services and exit 0
default_value: 'false'
+ - id: supabase-ssl-enforcement
+ title: supabase ssl-enforcement
+ summary: Manage SSL enforcement configuration
+ tags:
+ - management-api
+ links: []
+ subcommands:
+ - supabase-ssl-enforcement-get
+ - supabase-ssl-enforcement-update
+ flags: []
+ - id: supabase-ssl-enforcement-update
+ title: supabase ssl-enforcement update
+ summary: Update SSL enforcement configuration
+ tags: []
+ links: []
+ usage: supabase ssl-enforcement update [flags]
+ subcommands: []
+ flags:
+ - id: disable-db-ssl-enforcement
+ name: --disable-db-ssl-enforcement
+ description: |
+ Whether the DB should disable SSL enforcement for all external connections.
+ default_value: 'false'
+ - id: enable-db-ssl-enforcement
+ name: --enable-db-ssl-enforcement
+ description: |
+ Whether the DB should enable SSL enforcement for all external connections.
+ default_value: 'false'
+ - id: experimental
+ name: --experimental
+ description: enable experimental features
+ required: true
+ default_value: 'false'
+ - id: project-ref
+ name: --project-ref <string>
+ description: Project ref of the Supabase project.
+ default_value: ''
+ - id: supabase-ssl-enforcement-get
+ title: supabase ssl-enforcement get
+ summary: Get the current SSL enforcement configuration
+ tags: []
+ links: []
+ usage: supabase ssl-enforcement get
+ subcommands: []
+ flags:
+ - id: experimental
+ name: --experimental
+ description: enable experimental features
+ required: true
+ default_value: 'false'
+ - id: project-ref
+ name: --project-ref <string>
+ description: Project ref of the Supabase project.
+ default_value: ''
- id: supabase-secrets
title: supabase secrets
summary: Manage Supabase secrets
@@ -565,6 +648,55 @@ commands:
- id: supabase-migration-repair
title: supabase migration repair
summary: Repairs the migration history table
+ description: |2
+
+ Repairs the remote migration history table.
+
+ Requires your local project to be linked to a remote database by running `supabase link`.
+
+ If your local and remote migration history goes out of sync, you can repair the remote history by marking specific migrations as `--status applied` or `--status reverted`. Marking as `reverted` will delete an existing record from the migration history table while marking as `applied` will insert a new record.
+
+ For example, your migration history table may look like this after running `db remote commit` for the first time.
+
+ ```bash
+ $ supabase migration list
+ LOCAL │ REMOTE │ TIME (UTC)
+ ─────────────────┼────────────────┼──────────────────────
+ 20230103054303 │ 20230103054303 │ 2023-01-03 05:43:03
+ ```
+
+ To reset your migration history to a clean state, first delete your local migration file.
+
+ ```bash
+ $ rm supabase/migrations/20230103054303_remote_commit.sql
+ $ supabase migration list
+ 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
+ Repaired migration history: 20230103054303 => reverted
+ $ supabase migration list
+ LOCAL │ REMOTE │ TIME (UTC)
+ ─────────────────┼────────────────┼──────────────────────
+ ```
+
+ Now you can run `db remote commit` again to dump the remote schema as a local migration file.
+ examples:
+ - id: basic-usage
+ name: Mark a migration as reverted
+ code: supabase migration repair 20230103054303 --status reverted
+ response: |
+ Repaired migration history: 20230103054303 => reverted
+ - id: mark-applied
+ name: Mark a migration as applied
+ code: supabase migration repair 20230222032233 --status applied
+ response: |
+ Repaired migration history: 20230222032233 => applied
tags: []
links: []
usage: supabase migration repair <version> [flags]
@@ -586,17 +718,72 @@ commands:
- id: reverted
name: reverted
type: '[ applied | reverted ]'
+ - id: db-url
+ name: --db-url <string>
+ description: connect using the specified database url
+ default_value: ''
- id: supabase-migration-new
title: supabase migration new
summary: Create an empty migration script
+ description: |2
+
+ Creates a new migration file locally.
+
+ A `supabase/migrations` directory will be created if it does not already exists in your current `workdir`. All schema migration files must be created in this directory following the pattern `<timestamp>_<name>.sql`.
+
+ Outputs from other commands like `db diff` may be piped to `migration new <name>` via stdin.
+ 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>
subcommands: []
- flags: []
+ flags:
+ - id: db-url
+ name: --db-url <string>
+ description: connect using the specified database url
+ default_value: ''
- id: supabase-migration-list
title: supabase migration list
summary: List local and remote migrations
+ description: |2
+
+ Lists migration history in both local and remote databases.
+
+ Requires your local project to be linked to a remote database by running `supabase link`. For self-hosted databases, you can pass in the connection parameters using `--db-url` flag.
+
+ > Note that URL strings must be escaped according to [RFC 3986](https://www.rfc-editor.org/rfc/rfc3986).
+
+ Local migrations are stored in `supabase/migrations` directory while remote migrations are tracked in `supabase_migrations.schema_migrations` table. Only the timestamps are compared to identify any differences.
+
+ In case of discrepancies between the local and remote migration history, you can resolve them using the `migration repair` command.
+ examples:
+ - id: basic-usage
+ name: Basic usage
+ code: supabase migration list
+ 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 --db-url 'postgres://postgres[:percent_encoded_password]@localhost[: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]
@@ -606,6 +793,10 @@ commands:
name: -p, --password <string>
description: Password to your remote Postgres database.
default_value: ''
+ - id: db-url
+ name: --db-url <string>
+ description: connect using the specified database url
+ default_value: ''
- id: supabase-login
title: supabase login
summary: Authenticate using an access token
@@ -643,6 +834,8 @@ commands:
Optionally, database settings can be validated if you provide a password. Your database password is saved in native credentials storage if available.
+ > If you do not want to be prompted for the database password, such as in a CI environment, you may specify it explicitly via the `SUPABASE_DB_PASSWORD` environment variable.
+
Some commands like `db dump`, `db push`, and `db remote commit` require your project to be linked first.
examples:
- id: basic-usage
@@ -657,6 +850,12 @@ commands:
response: |
Enter your database password:
Finished supabase link.
+ - id: using-alternate-dns
+ name: Link using DNS-over-HTTPS resolver
+ code: supabase link --project-ref ******************** --dns-resolver https
+ response: |
+ Enter your database password:
+ Finished supabase link.
tags:
- local-dev
links: []
@@ -681,7 +880,7 @@ commands:
A `supabase/config.toml` file is created in your current working directory. This configuration is specific to each local project.
- > You may override the directory path by specifying the `SUPABASE_WORKDIR` environment variable.
+ > You may override the directory path by specifying the `SUPABASE_WORKDIR` environment variable or `--workdir` flag.
In addition to `config.toml`, the `supabase` directory may also contain other Supabase objects, such as `migrations`, `functions`, `tests`, etc.
examples:
@@ -761,10 +960,10 @@ commands:
flags: []
- id: supabase-functions-serve
title: supabase functions serve
- summary: Serve all functions locally
+ summary: Serve all Functions locally
tags: []
links: []
- usage: supabase functions serve [flags]
+ usage: supabase functions serve <Function name> [flags]
subcommands: []
flags:
- id: env-file
@@ -975,7 +1174,11 @@ commands:
links: []
usage: supabase db start
subcommands: []
- flags: []
+ flags:
+ - id: db-url
+ name: --db-url <string>
+ description: connect using the specified database url
+ default_value: ''
- id: supabase-db-reset
title: supabase db reset
summary: Resets the local database to current migrations
@@ -983,7 +1186,11 @@ commands:
links: []
usage: supabase db reset
subcommands: []
- flags: []
+ flags:
+ - id: db-url
+ name: --db-url <string>
+ description: connect using the specified database url
+ default_value: ''
- id: supabase-db-remote
title: supabase db remote
summary: Manage remote databases
@@ -1000,6 +1207,10 @@ commands:
usage: supabase db remote commit
subcommands: []
flags:
+ - id: db-url
+ name: --db-url <string>
+ description: connect using the specified database url
+ default_value: ''
- id: password
name: -p, --password <string>
description: Password to your remote Postgres database.
@@ -1025,6 +1236,10 @@ commands:
name: -p, --password <string>
description: Password to your remote Postgres database.
default_value: ''
+ - id: db-url
+ name: --db-url <string>
+ description: connect using the specified database url
+ default_value: ''
- id: supabase-db-lint
title: supabase db lint
summary: Checks local database for typing error
@@ -1048,22 +1263,38 @@ commands:
name: -s, --schema <strings>
description: List of schema to include.
default_value: all
+ - id: db-url
+ name: --db-url <string>
+ description: connect using the specified database url
+ default_value: ''
- id: supabase-db-dump
title: supabase db dump
- summary: Dumps schemas from the remote database
+ summary: Dumps data or schemas from the remote database
tags: []
links: []
usage: supabase db dump [flags]
subcommands: []
flags:
+ - id: data-only
+ name: --data-only
+ description: Dumps only data records.
+ default_value: 'false'
- id: file
name: -f, --file <string>
- description: File path to save the dumped schema.
+ description: File path to save the dumped contents.
default_value: ''
- id: password
name: -p, --password <string>
description: Password to your remote Postgres database.
default_value: ''
+ - id: role-only
+ name: --role-only
+ description: Dumps only cluster roles.
+ default_value: 'false'
+ - id: db-url
+ name: --db-url <string>
+ description: connect using the specified database url
+ default_value: ''
- id: supabase-db-diff
title: supabase db diff
summary: Diffs the local database for schema changes
@@ -1092,6 +1323,10 @@ commands:
name: --use-pgadmin
description: Use pgAdmin to generate schema diff.
default_value: 'false'
+ - id: db-url
+ name: --db-url <string>
+ description: connect using the specified database url
+ default_value: ''
- id: supabase-completion
title: supabase completion
summary: Generate the autocompletion script for the specified shell