Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
272 changes: 272 additions & 0 deletions docs/commands/database.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,272 @@
---
title: Netlify CLI database command
description: Provision a production ready Postgres database with a single command
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟑 Minor

Hyphenate β€œproduction-ready” in command description text.

Use production-ready (compound adjective) instead of production ready in both the frontmatter description and generated command description text.

✏️ Proposed wording tweak
-description: Provision a production ready Postgres database with a single command
+description: Provision a production-ready Postgres database with a single command
-Provision a production ready Postgres database with a single command
+Provision a production-ready Postgres database with a single command

Also applies to: 12-12

πŸ€– Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/commands/database.md` at line 3, Update the frontmatter and any
generated command description text to hyphenate the compound adjective: change
the value for the frontmatter key "description" from "production ready" to
"production-ready" and replace any other occurrences of the exact phrase
"production ready" in the generated command description output (search for
"production ready" in the file and related generation/template code) so the
command description consistently reads "production-ready".

sidebar:
label: database
---

# `database`


<!-- AUTO-GENERATED-CONTENT:START (GENERATE_COMMANDS_DOCS) -->
Provision a production ready Postgres database with a single command

**Usage**

```bash
netlify database
```

**Flags**

- `filter` (*string*) - For monorepos, specify the name of the application to run the command in
- `debug` (*boolean*) - Print debugging information
- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in

| Subcommand | description |

Check warning on line 26 in docs/commands/database.md

View workflow job for this annotation

GitHub Actions / lint-docs

[vale] reported by reviewdog 🐢 [base.spelling] Spellcheck: did you really mean 'Subcommand'? Raw Output: {"message": "[base.spelling] Spellcheck: did you really mean 'Subcommand'?", "location": {"path": "docs/commands/database.md", "range": {"start": {"line": 26, "column": 3}}}, "severity": "WARNING"}
|:--------------------------- |:-----|
| [`database status`](/commands/database#database-status) | Check the status of the database, including applied and pending migrations |
| [`database init`](/commands/database#database-init) | Interactive setup: install the package, scaffold a starter migration, and verify the database |
| [`database connect`](/commands/database#database-connect) | Connect to the database |
| [`database reset`](/commands/database#database-reset) | Reset the local development database, removing all data and tables |
| [`database migrations`](/commands/database#database-migrations) | Manage database migrations |


**Examples**

```bash
netlify database status
netlify database migrations apply
netlify database migrations pull
netlify database migrations new
netlify database reset
```

---
## `database status`

Check the status of the database, including applied and pending migrations

**Usage**

```bash
netlify database status
```
Comment thread
coderabbitai[bot] marked this conversation as resolved.

**Flags**

- `branch` (*string*) - Netlify branch name to query; defaults to the local development database
- `json` (*boolean*) - Output result as JSON
- `show-credentials` (*boolean*) - Include the full connection string (including username and password) in the output
- `debug` (*boolean*) - Print debugging information
- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in

**Examples**

```bash
netlify database status
netlify database status --show-credentials
netlify database status --json
netlify database status --branch my-feature-branch
```

---
## `database init`

Interactive setup: install the package, scaffold a starter migration, and verify the database

**Usage**

```bash
netlify database init
```

**Flags**

- `filter` (*string*) - For monorepos, specify the name of the application to run the command in
- `yes` (*boolean*) - Non-interactive mode. Accepts the defaults for every prompt.
- `debug` (*boolean*) - Print debugging information
- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in

**Examples**

```bash
netlify database init
netlify database init --yes
```

---
## `database connect`

Connect to the database

**Usage**

```bash
netlify database connect
```

**Flags**

- `filter` (*string*) - For monorepos, specify the name of the application to run the command in
- `json` (*boolean*) - Output query results as JSON. When used without --query, prints the connection details as JSON instead.
- `query` (*string*) - Execute a single query and exit
- `debug` (*boolean*) - Print debugging information
- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in

**Examples**

```bash
netlify database connect
netlify database connect --query "SELECT * FROM users"
netlify database connect --json --query "SELECT * FROM users"
netlify database connect --json
```

---
## `database reset`

Reset the local development database, removing all data and tables

**Usage**

```bash
netlify database reset
```

**Flags**

- `filter` (*string*) - For monorepos, specify the name of the application to run the command in
- `json` (*boolean*) - Output result as JSON
- `debug` (*boolean*) - Print debugging information
- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in

---
## `database migrations`

Manage database migrations

**Usage**

```bash
netlify database migrations
```

**Flags**

- `filter` (*string*) - For monorepos, specify the name of the application to run the command in
- `debug` (*boolean*) - Print debugging information
- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in

| Subcommand | description |

Check warning on line 161 in docs/commands/database.md

View workflow job for this annotation

GitHub Actions / lint-docs

[vale] reported by reviewdog 🐢 [base.spelling] Spellcheck: did you really mean 'Subcommand'? Raw Output: {"message": "[base.spelling] Spellcheck: did you really mean 'Subcommand'?", "location": {"path": "docs/commands/database.md", "range": {"start": {"line": 161, "column": 3}}}, "severity": "WARNING"}
|:--------------------------- |:-----|
| [`database migrations apply`](/commands/database#database-migrations-apply) | Apply database migrations to the local development database |
| [`database migrations new`](/commands/database#database-migrations-new) | Create a new migration |
| [`database migrations pull`](/commands/database#database-migrations-pull) | Pull migrations and overwrite local migration files |
| [`database migrations reset`](/commands/database#database-migrations-reset) | Delete local migration files that have not been applied yet |


---
## `database migrations apply`

Apply database migrations to the local development database

**Usage**

```bash
netlify database migrations apply
```

**Flags**

- `filter` (*string*) - For monorepos, specify the name of the application to run the command in
- `json` (*boolean*) - Output result as JSON
- `to` (*string*) - Target migration name or prefix to apply up to (applies all if omitted)
- `debug` (*boolean*) - Print debugging information
- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in

---
## `database migrations new`

Create a new migration

**Usage**

```bash
netlify database migrations new
```

**Flags**

- `description` (*string*) - Purpose of the migration (used to generate the file name)
- `filter` (*string*) - For monorepos, specify the name of the application to run the command in
- `json` (*boolean*) - Output result as JSON
- `scheme` (*sequential | timestamp*) - Numbering scheme for migration prefixes
- `debug` (*boolean*) - Print debugging information
- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in

**Examples**

```bash
netlify database migrations new
netlify database migrations new --description "add users table" --scheme sequential
```

---
## `database migrations pull`

Pull migrations and overwrite local migration files

**Usage**

```bash
netlify database migrations pull
```

**Flags**

- `branch` (*string*) - Pull migrations for a specific branch (defaults to 'production'; pass --branch with no value to use local git branch)
- `filter` (*string*) - For monorepos, specify the name of the application to run the command in
- `force` (*boolean*) - Skip confirmation prompt
- `debug` (*boolean*) - Print debugging information
- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in
- `json` (*boolean*) - Output result as JSON

**Examples**

```bash
netlify database migrations pull
netlify database migrations pull --branch staging
netlify database migrations pull --branch
netlify database migrations pull --force
```

---
## `database migrations reset`

Delete local migration files that have not been applied yet

**Usage**

```bash
netlify database migrations reset
```

**Flags**

- `branch` (*string*) - Target a remote preview branch instead of the local development database
- `filter` (*string*) - For monorepos, specify the name of the application to run the command in
- `json` (*boolean*) - Output result as JSON
- `debug` (*boolean*) - Print debugging information
- `auth` (*string*) - Netlify auth token - can be used to run this command without logging in

**Examples**

```bash
netlify database migrations reset
netlify database migrations reset --branch my-feature-branch
```

---

<!-- AUTO-GENERATED-CONTENT:END -->
86 changes: 0 additions & 86 deletions docs/commands/db.md

This file was deleted.

9 changes: 6 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,17 @@ Generate shell completion script

Create a new Netlify project using an AI agent

### [db](/commands/db)
### [database](/commands/database)

Provision a production ready Postgres database with a single command

| Subcommand | description |
|:--------------------------- |:-----|
| [`init`](/commands/db#init) | Initialize a new database for the current site |
| [`status`](/commands/db#status) | Check the status of the database |
| [`database status`](/commands/database#database-status) | Check the status of the database, including applied and pending migrations |
| [`database init`](/commands/database#database-init) | Interactive setup: install the package, scaffold a starter migration, and verify the database |
| [`database connect`](/commands/database#database-connect) | Connect to the database |
| [`database reset`](/commands/database#database-reset) | Reset the local development database, removing all data and tables |
| [`database migrations`](/commands/database#database-migrations) | Manage database migrations |
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not the best place to mention this because this is index - but we generally had docs generating problem that subcommands where not prefixing commands with db/database before, so in particular usage examples where not generated correctly (for example instead of netlify database status it was printing netlify status on database page which was wrong.

Similarly database migrations subcommands (reset, apply, etc) were just not generated at all

So all the docs generating changes are for those cases.

The main "proof" of docs generating fixes working (at least with our current commands) is the shape of generated docs and fact that commands other than database were NOT touched.



### [deploy](/commands/deploy)
Expand Down
Loading
Loading