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 db commands with detail descriptions

Qiao Han0df5f2321367
diff --git a/spec/cli_v1_commands.yaml b/spec/cli_v1_commands.yaml
index 05f64930410..7901e5cfab8 100644
--- a/spec/cli_v1_commands.yaml
+++ b/spec/cli_v1_commands.yaml
@@ -1,7 +1,7 @@
-elispec: '001'
+clispec: '001'
info:
id: cli
- version: 1.42.0
+ version: 1.50.12
title: Supabase CLI
language: sh
source: https://github.com/supabase/cli
@@ -405,6 +405,15 @@ commands:
- id: supabase-test-db
title: supabase test db
summary: Tests local database with pgTAP
+ description: |2
+
+ Executes pgTAP tests against the local database.
+
+ Requires the local development stack to be started by running `supabase start`.
+
+ Runs `pg_prove` in a container with unit test files volume mounted from `supabase/tests` directory. The test file can be suffixed by either `.sql` or `.pg` extension.
+
+ Since each test is wrapped in its own transaction, it will be individually rolled back regardless of success or failure.
tags: []
links: []
usage: supabase test db
@@ -494,25 +503,25 @@ commands:
subcommands: []
flags:
- id: output
- name: -o, --output <[ env | json | pretty | toml | yaml ]>
+ 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 | json | pretty | toml | yaml ]'
- - id: json
- name: json
- type: '[ env | json | pretty | toml | yaml ]'
+ type: '[ env | pretty | json | toml | yaml ]'
- id: pretty
name: pretty
- type: '[ env | json | pretty | toml | yaml ]'
+ type: '[ env | pretty | json | toml | yaml ]'
+ - id: json
+ name: json
+ type: '[ env | pretty | json | toml | yaml ]'
- id: toml
name: toml
- type: '[ env | json | pretty | toml | yaml ]'
+ type: '[ env | pretty | json | toml | yaml ]'
- id: yaml
name: yaml
- type: '[ env | json | pretty | toml | yaml ]'
+ type: '[ env | pretty | json | toml | yaml ]'
- id: override-name
name: --override-name <strings>
description: Override specific variable names.
@@ -563,7 +572,7 @@ 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,edge-runtime,logflare,vector]
default_value: '[]'
- id: ignore-health-check
name: --ignore-health-check
@@ -759,6 +768,9 @@ commands:
- id: us-west-1
name: us-west-1
type: string
+ - id: us-west-2
+ name: us-west-2
+ type: string
- id: supabase-orgs
title: supabase orgs
summary: Manage Supabase organizations
@@ -1089,19 +1101,19 @@ commands:
name: Basic usage
code: supabase link --project-ref ********************
response: |
- Enter your database password: ********
+ Enter your database password (or leave blank to skip): ********
Finished supabase link.
- id: without-password
name: Link without database password
code: supabase link --project-ref ******************** <<< ""
response: |
- Enter your database password:
+ Enter your database password (or leave blank to skip):
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:
+ Enter your database password (or leave blank to skip):
Finished supabase link.
tags:
- local-dev
@@ -1429,6 +1441,13 @@ commands:
- id: supabase-db-reset
title: supabase db reset
summary: Resets the local database to current migrations
+ description: |2
+
+ Resets the local database to a clean state.
+
+ Requires the local development stack to be started by running `supabase start`.
+
+ Recreates the local Postgres container and applies all local migrations found in `supabase/migrations` directory. If test data is defined in `supabase/seed.sql`, it will be seeded after the migrations are run. Any other data or schema changes made during local development will be discarded.
tags: []
links: []
usage: supabase db reset
@@ -1469,6 +1488,17 @@ commands:
- id: supabase-db-push
title: supabase db push
summary: Push new migrations to the remote database
+ description: |2
+
+ Pushes all local migrations to a remote database.
+
+ 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.
+
+ The first time this command is run, a migration history table will be created under `supabase_migrations.schema_migrations`. After successfully applying a migration, a new row will be inserted into the migration history table with timestamp as its unique id. Subsequent pushes will skip migrations that have already been applied.
+
+ If you need to mutate the migration history table, such as deleting existing entries or inserting new entries without actually running the migration, use the `migration repair` command.
+
+ Use the `--dry-run` flag to view the list of changes before applying.
tags: []
links: []
usage: supabase db push [flags]
@@ -1490,6 +1520,15 @@ commands:
- id: supabase-db-lint
title: supabase db lint
summary: Checks local database for typing error
+ description: |2
+
+ Lints local database for schema errors.
+
+ Requires the local development stack to be running when linting against the local database. To lint against a remote or self-hosted database, specify the `--linked` or `--db-url` flag respectively.
+
+ Runs `plpgsql_check` extension in the local Postgres container to check for errors in all schemas. The default lint level is error and is configurable via the `--level` flag.
+
+ To lint against specific schemas only, pass in the `--schema` flag.
tags: []
links: []
usage: supabase db lint [flags]
@@ -1517,6 +1556,15 @@ commands:
- id: supabase-db-dump
title: supabase db dump
summary: Dumps data or schemas from the remote database
+ description: |2
+
+ Dumps contents from a remote database.
+
+ 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.
+
+ Runs `pg_dump` in a container with additonal flags to exclude Supabase managed schemas. The ignored schemas include auth, stroage, and those created by extensions.
+
+ The default dump does not contain any data or custom roles. To dump those contents explicitly, specify either the `--data-only` and `--role-only` flag.
tags: []
links: []
usage: supabase db dump [flags]
@@ -1545,6 +1593,21 @@ commands:
- id: supabase-db-diff
title: supabase db diff
summary: Diffs the local database for schema changes
+ description: |2
+
+ Diffs schema changes made to the local or remote database.
+
+ Requires the local development stack to be running when diffing against the local database. To diff against a remote or self-hosted database, specify the `--linked` or `--db-url` flag respectively.
+
+ Runs [djrobstep/migra](https://github.com/djrobstep/migra) in a container to compare schema differences between the target database and a shadow database. The shadow database is created by applying migrations in local `supabase/migrations` directory in a separate container. Output is written to stdout by default. For convenience, you can also save the schema diff as a new migration file by passing in `-f` flag.
+
+ By default, all schemas in the target database are diffed. Use the `--schema public,extensions` flag to restrict diffing to a subset of schemas.
+
+ While the diff command is able to capture most schema changes, there are cases where it is known to fail. Currently, this could happen if you schema contains:
+
+ - Changes to publication
+ - Changes to storage buckets
+ - Views with `security_invoker` attributes
tags: []
links: []
usage: supabase db diff [flags]
@@ -1602,7 +1665,7 @@ commands:
To load completions in your current shell session:
- source <(supabase completion zsh); compdef _supabase supabase
+ source <(supabase completion zsh)
To load completions for every new session, execute once: