Skip to content

Commit 46f0048

Browse files
committed
docs(reference): update CLI section
1 parent 3011712 commit 46f0048

File tree

1 file changed

+158
-46
lines changed

1 file changed

+158
-46
lines changed

web/spec/cli.yml

Lines changed: 158 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -2,96 +2,208 @@ openref: 0.1
22

33
info:
44
id: reference/cli
5-
title: Getting started
5+
title: About
66
description: |
7-
87
The Supabase CLI can be found in our [CLI](https://github.com/supabase/cli) repository.
98
10-
The CLI is still under heavy development, but it will contain all the functionality for working with Supabase projects and the Supabase platform.
11-
129
- [x] Running Supabase locally
13-
- [x] Self-hosting
14-
- [ ] Managing database migrations (in progress)
15-
- [ ] Pushing your local changes to production
10+
- [x] Managing database migrations
11+
- [x] Pushing your local changes to production
1612
- [ ] Manage your Supabase Account
1713
- [ ] Manage your Supabase Projects
1814
- [ ] Generating types directly from your database schema
1915
- [ ] Generating API and validation schemas from your database
2016
2117
## Installing the CLI
2218
23-
```bash
24-
npm install supabase -g
25-
```
19+
Installation instructions can be found [here](https://github.com/supabase/cli#install-the-cli).
2620
27-
There may be additional steps that you need to follow to setup the CLI. Located [here](https://supabase.com/docs/guides/local-development).
21+
## Support
2822
23+
Report issues to our [issue tracker](https://github.com/supabase/cli/issues).
2924
definition: spec/combined.json
3025
libraries:
31-
- name: 'sh'
32-
id: 'sh'
33-
version: '0.0.1'
26+
- name: "sh"
27+
id: "sh"
28+
version: "0.0.1"
3429
docs:
3530
path: reference/cli/
3631
sidebar:
37-
- name: 'About'
32+
- name: "About"
3833
items:
3934
- index
40-
- supabase init
41-
- name: 'Local Development'
35+
- name: "Command reference"
4236
items:
37+
- supabase help
38+
- supabase init
4339
- supabase start
44-
- supabase stop
45-
- supabase eject
40+
- supabase db branch list
41+
- supabase db branch create
42+
- supabase db branch delete
43+
- supabase db switch
44+
- supabase db changes
45+
- supabase db commit
46+
- supabase db reset
47+
- supabase db remote set
48+
- supabase db remote commit
49+
- supabase db push
50+
- supabase migration new
51+
- name: "Config reference"
52+
items:
53+
- Config reference
4654

4755
pages:
56+
supabase help:
57+
description: |
58+
```
59+
Help provides help for any command in the application.
60+
Simply type supabase help [path to command] for full details.
61+
62+
Usage:
63+
supabase help [command]
64+
```
65+
4866
supabase init:
4967
description: |
50-
```bash
51-
supabase init
5268
```
69+
Initialize a project to use Supabase CLI.
5370
54-
This command will create a .supabase folder which holds all the configurations for developing your project locally. You don't need to check this into version control.
71+
Usage:
72+
supabase init
73+
```
5574
56-
After you run `supabase init` you will be guided through a series of questions, and if everything goes well, you will see an output similar to this:
75+
supabase start:
76+
description: |
77+
```
78+
Start the Supabase local development setup.
5779
58-
```txt
59-
✔ Port for Supabase URL: · 8000
60-
✔ Port for PostgreSQL database: · 5432
61-
✔ Project initialized.
62-
Supabase URL: http://localhost:8000
63-
Supabase Key: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzdXBhYmFzZSIsImlhdCI6MTYwMzk2ODgzNCwiZXhwIjoyNTUwNjUzNjM0LCJhdWQiOiIiLCJzdWIiOiIiLCJSb2xlIjoicG9zdGdyZXMifQ.magCcozTMKNrl76Tj2dsM7XTl_YH0v0ilajzAvIlw3U
64-
Database URL: postgres://postgres:postgres@localhost:5432/postgres
80+
Usage:
81+
supabase start
82+
```
6583
66-
Run supabase start to start the local emulator.
84+
supabase db branch list:
85+
description: |
6786
```
87+
List branches.
6888
69-
supabase start:
89+
Usage:
90+
supabase db branch list
91+
```
92+
93+
supabase db branch create:
94+
description: |
95+
```
96+
Create a branch.
97+
98+
Usage:
99+
supabase db branch create <branch name>
100+
```
101+
102+
supabase db branch delete:
103+
description: |
104+
```
105+
Delete a branch.
106+
107+
Usage:
108+
supabase db branch delete <branch name>
109+
```
110+
111+
supabase db switch:
112+
description: |
113+
```
114+
Switch branches.
115+
116+
Usage:
117+
supabase db switch <branch name>
118+
```
119+
120+
supabase db changes:
70121
description: |
71-
```bash
72-
supabase start
73122
```
123+
Diffs the local database with current migrations, then print the diff to standard output.
74124
75-
This command uses Docker Compose to start all the open source [services](/docs/#how-it-works) of Supabase. This command will take a while to run, there are a lot of services to build.
125+
Usage:
126+
supabase db changes
127+
```
128+
129+
supabase db commit:
130+
description: |
131+
```
132+
Diffs the local database with current migrations, writing it as a new migration.
133+
134+
Usage:
135+
supabase db commit <migration name>
136+
```
137+
138+
supabase db reset:
139+
description: |
140+
```
141+
Resets the local database to reflect current migrations. Any changes on the local database that is not committed will be lost.
76142
77-
Once this is running, you will see the health services in Docker Dashboard:
143+
Usage:
144+
supabase db reset
145+
```
146+
147+
supabase db remote set:
148+
description: |
149+
```
150+
Set the remote database to push migrations to.
151+
152+
Usage:
153+
supabase db remote set <remote database url>
154+
```
155+
156+
supabase db remote commit:
157+
description: |
158+
```
159+
Commit changes on the remote database since the last pushed migration.
78160
79-
![Docker Supabase](/img/docker-supabase.png)
161+
Usage:
162+
supabase db remote commit
163+
```
80164
81-
supabase stop:
165+
supabase db push:
82166
description: |
83-
```bash
84-
supabase stop
85167
```
168+
Push new migrations to the remote database.
86169
87-
When you are finished with Supabase, run `supabase stop` to stop the Docker services.
170+
Usage:
171+
supabase db push
172+
```
88173
89-
supabase eject:
174+
supabase migration new:
90175
description: |
91-
```bash
92-
supabase eject
93176
```
177+
Create an empty migration.
178+
179+
Usage:
180+
supabase migration new <migration name>
181+
```
182+
183+
Config reference:
184+
description: |
185+
The config file resides in `supabase/config.json` after you run `supabase init`.
186+
187+
#### `projectId` (required)
188+
189+
A string used to distinguish different Supabase projects on the same host. Defaults to the working directory name when running `supabase init`.
190+
191+
#### `ports.api` (required)
192+
193+
Host port used for the API URL. Defaults to `54321`.
194+
195+
#### `ports.db` (required)
196+
197+
Host port used for the DB URL. Defaults to `54322`.
198+
199+
#### `ports.studio` (required)
200+
201+
Host port used for Supabase Studio. Defaults to `54323`.
202+
203+
#### `ports.inbucket` (optional)
204+
205+
Host port used for the web interface of Inbucket email testing server. When not specified, emails are automatically confirmed. When specified, emails are not sent to the recipient, but rather monitored and accessible via the web interface.
94206
95-
Run in any folder to create a `docker` folder with a `docker-compose.yml`. This is useful for self-hosting or adding custom configuration.
207+
#### `dbVersion` (required)
96208
97-
See our [Self Hosting](/docs/guides/hosting/overview) docs for more details.
209+
Server version number used for the database. This needs to match the server version number of the remote database you intend to link to with `supabase db remote set`. You can retrieve it by running `SHOW server_version_num`.

0 commit comments

Comments
 (0)