-
Notifications
You must be signed in to change notification settings - Fork 395
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
Open
CalebBarnes
wants to merge
18
commits into
main
Choose a base branch
from
feat/netlify-database-command
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+745
−5
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DanielSLew
reviewed
Mar 20, 2025
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
…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 <=>
da4a73c
to
f4a9e6a
Compare
khendrikse
approved these changes
May 5, 2025
- if db already connected, we just say its connected and continue to log the status - improve status by fetching cli-db-status extension endpoint
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
--minimal
flag for non-interactive setup (ideal for CI/AI tools)--drizzle
/--no-drizzle
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)