-
Notifications
You must be signed in to change notification settings - Fork 452
feat!: add support for new Netlify Database primitive #8212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
fbad04f
094bee2
4d36191
44c9561
2361208
6f18dd1
0c65e7e
32092b7
019d487
a2175bc
1d2313a
d2f3f3f
3661009
d8d60f4
27240cc
692b167
0cf185e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 | ||
| 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
|
||
| |:--------------------------- |:-----| | ||
| | [`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 | ||
| ``` | ||
|
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
|
||
| |:--------------------------- |:-----| | ||
| | [`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 --> | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 Similarly 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) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hyphenate βproduction-readyβ in command description text.
Use
production-ready(compound adjective) instead ofproduction readyin both the frontmatter description and generated command description text.βοΈ Proposed wording tweak
Also applies to: 12-12
π€ Prompt for AI Agents