-
Notifications
You must be signed in to change notification settings - Fork 414
feat: Add db init
and db status
commands
#7115
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
Conversation
We could add logic that if we notice that the site is not linked yet, we ask them if they want to do that, if they say yes we continue into that workflow? |
4fc477a
to
bd11f72
Compare
0f307a0
to
1cf19cb
Compare
database
init commanddb init
and db status
commands
da4a73c
to
f4a9e6a
Compare
3dc215b
to
3aae68f
Compare
…unused function / add --yes option to use defaults and --overwrite to overwrite files
* feat: add local dev branch option * add UNPOOLED env to db status command * add nf-db-user-id to req headers and update endpoint url * fix name for NETLIFY_DATABASE_URL_UNPOOLED * update NEON_DATABASE_EXTENSION_SLUG to 'neon' and remove NETLIFY_WEB_UI constant * remove dev command and dev-branch.ts * init: remove/replace headers for Nf-UIExt headers / remove dev branch questions * update getExtension, installExtension to call jigsaw directly instead of calling react ui endpoints * token -> netlifyToken * drizzle - fixes/cleanup & remove dev branch config * remove localDevBranch from Answers type --------- Co-authored-by: Karin <=>
- if db already connected, we just say its connected and continue to log the status - improve status by fetching cli-db-status extension endpoint
bd5881d
to
cadddbc
Compare
1dd6961
to
191fc80
Compare
…mand.project.root not found
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.
submitting a few comments while I review the rest of the PR
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.
Minor comments throughout; the only ones I feel strongly about are changing the --minimal
flag to be more explanatory, and changing --drizzle
to --orm
/--boilerplate
/something else.
…or dev (#7319) * feat: add handling of extension requirements except doing nothing but logging * feat: require users to init a site in dev if they have neon package installed * chore: better comment * chore: format * feat: move back to logical or * refactor: address review comments --------- Co-authored-by: Nathan Houle <[email protected]>
Summary
This PR introduces a new
db
command to the Netlify CLI, enabling users to provision and manage production-ready Postgres databases with minimal effort.Features
Adds
netlify db
command with two primary subcommands:db init
- Initialize a new database and connects it to the current sitedb status
- Check the status of the database connectionSeamless integration with Drizzle ORM:
Flexible setup options:
--assume-no
flag for non-interactive setup (ideal for CI/AI tools)--boilerplate=drizzle
and--no-boilerplate
flags to control ORM setup--overwrite
option to replace existing boilerplate filesExample Usage
The implementation automatically handles extension installation, creating a database, and connecting it to the site via environment variables.
Documentation Generation Enhancement
I expanded the CLI documentation generator to support subcommands more robustly. Previously, subcommand docs were only generated if the command name contained a colon (
:
), such asdev:exec
, which would be treated as a subcommand ofdev
. This approach missed subcommands defined as nested classes or those with explicit parent references.Now, the docs generator also recognizes subcommands by checking the command's
parent
property, allowing it to correctly generate documentation for subcommands like those under the newdb
command without relying solely on colon-separated naming.For us to review and ship your PR efficiently, please perform the following steps:
passes our tests.
A picture of a cute animal (not mandatory, but encouraged)