feat: add deprecation messaging for legacy Netlify DB extension#8141
feat: add deprecation messaging for legacy Netlify DB extension#8141
Conversation
📝 WalkthroughWalkthroughThis change adds deprecation notices to two database-related CLI commands when the experimental Netlify database feature is enabled. The first file introduces a new Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
📊 Benchmark resultsComparing with 40e56cf
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/commands/database/status.ts (1)
80-80: Remove the explanatory inline comment.The condition already makes the intent clear, so this comment is redundant and can be removed.
Suggested change
- // Show deprecation warning if a legacy extension DB is detected if (databaseUrlEnv?.key === 'NETLIFY_DATABASE_URL') {As per coding guidelines,
Never write comments on what the code does; make the code clean and self-explanatory instead.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/commands/database/status.ts` at line 80, Remove the redundant inline comment "// Show deprecation warning if a legacy extension DB is detected" that sits above the condition which detects a legacy extension DB in the status command handler; leave the condition and deprecation warning logic intact (no code changes other than deleting that comment) so the intent is expressed by the condition itself.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/commands/database/database.ts`:
- Line 96: Update the CLI help text for the "db init" command so the
.description() string reflects the command's actual behavior (it only displays a
deprecation/migration message rather than initializing a DB). Locate the
.description('Initialize a new database for the current site') call in the
database command setup (the db init command definition) and replace the text
with a concise message like "Display deprecation/migration notice for database
initialization" or "Show deprecation/migration instructions for db init" so help
output matches runtime behavior.
---
Nitpick comments:
In `@src/commands/database/status.ts`:
- Line 80: Remove the redundant inline comment "// Show deprecation warning if a
legacy extension DB is detected" that sits above the condition which detects a
legacy extension DB in the status command handler; leave the condition and
deprecation warning logic intact (no code changes other than deleting that
comment) so the intent is expressed by the condition itself.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: bc262789-4240-48dc-997a-76e06439801b
📒 Files selected for processing (2)
src/commands/database/database.tssrc/commands/database/status.ts
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
11c812f to
704a7b6
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/commands/database/legacy/db-status.ts (1)
80-80: Remove behavior-describing inline comment.The code is already clear; this comment can be dropped to match repo style.
As per coding guidelines,
**/*.{ts,tsx,js,jsx}: Never write comments on what the code does; make the code clean and self-explanatory instead.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/commands/database/legacy/db-status.ts` at line 80, Remove the inline comment "Show deprecation warning if a legacy extension DB is detected" from db-status.ts so the code remains self-descriptive; simply delete that comment line and do not add any explanatory comment in its place (no code changes beyond removing that comment).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/commands/database/database.ts`:
- Around line 109-121: Update the deprecation message in the `db init` command
handler (the chained .description/.action block) to stop recommending the
non-existent `@netlify/database` package: replace the install hint string
currently using `npm install `@netlify/database`` with `npm install `@netlify/neon``
(or remove the install hint entirely if you prefer to only state deprecation);
ensure the change is made in the anonymous async action that constructs the
log/chalk messages so the displayed cyan install command is corrected.
In `@src/commands/database/legacy/db-status.ts`:
- Line 81: The deprecation guard in src/commands/database/legacy/db-status.ts
uses if (process.env.EXPERIMENTAL_NETLIFY_DB_ENABLED === '1' &&
databaseUrlEnv?.key === 'NETLIFY_DATABASE_URL') which is unreachable because
this legacy command is only registered when EXPERIMENTAL_NETLIFY_DB_ENABLED !==
'1'; change the condition so the warning runs when the legacy command is active
(e.g., flip the env check to !== '1' or remove the env check entirely and only
test databaseUrlEnv?.key === 'NETLIFY_DATABASE_URL') so the deprecation message
is actually emitted by the legacy db-status command.
---
Nitpick comments:
In `@src/commands/database/legacy/db-status.ts`:
- Line 80: Remove the inline comment "Show deprecation warning if a legacy
extension DB is detected" from db-status.ts so the code remains
self-descriptive; simply delete that comment line and do not add any explanatory
comment in its place (no code changes beyond removing that comment).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 6c07538e-1520-4e75-bf91-36d1a4a672f9
📒 Files selected for processing (2)
src/commands/database/database.tssrc/commands/database/legacy/db-status.ts
| .description('Deprecated: databases are auto-provisioned via `@netlify/database`') | ||
| .action(async (_options: Record<string, unknown>, _command: BaseCommand) => { | ||
| const { log, chalk } = await import('../../utils/command-helpers.js') | ||
|
|
||
| log() | ||
| log( | ||
| chalk.yellow( | ||
| '`netlify db init` is no longer available. Databases are now provisioned automatically when @netlify/database is detected in your project.', | ||
| ), | ||
| ) | ||
| log() | ||
| log('To get started, run:') | ||
| log(` ${chalk.cyan('npm install @netlify/database')}`) |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
What is the current official npm package and install command for Netlify Database in Netlify CLI docs: @netlify/dbor@netlify/database?
💡 Result:
There is no separate official npm package like @netlify/db or @netlify/database required for Netlify Database in the Netlify CLI docs. Netlify Database functionality is built into the Netlify CLI itself (npm package: netlify-cli), which provides the netlify db commands such as netlify db init and netlify db status for provisioning and managing the database. For local development, use npx netlify db init (which runs the latest netlify-cli without global install). Install Netlify CLI with npm install netlify-cli -g or npm install --save-dev netlify-cli for projects/CI. Optionally, for automatic database provisioning during builds, install @netlify/neon in your project: npm install @netlify/neon. This is not the core CLI package and was mentioned in beta docs; Netlify DB uses Neon Postgres under the hood.
Citations:
- 1: https://www.npmjs.com/package/netlify-cli
- 2: https://cli.netlify.com/
- 3: https://docs.netlify.com/build/data-and-storage/netlify-db/
- 4: https://docs.netlify.com/api-and-cli-guides/cli-guides/get-started-with-cli/
- 5: https://main--cli.netlify.app/commands/db/
Replace the deprecated @netlify/database package with correct instructions.
The deprecation message directs users to install @netlify/database, but this package does not exist. According to official Netlify docs, the correct package for automatic database provisioning is @netlify/neon. Update lines 115–116 to install the correct package:
npm install `@netlify/neon`
Alternatively, if the intent is to simply inform users that the netlify db init command is deprecated without requiring a separate package installation (since Netlify Database is built into netlify-cli), adjust the message accordingly.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/commands/database/database.ts` around lines 109 - 121, Update the
deprecation message in the `db init` command handler (the chained
.description/.action block) to stop recommending the non-existent
`@netlify/database` package: replace the install hint string currently using
`npm install `@netlify/database`` with `npm install `@netlify/neon`` (or remove the
install hint entirely if you prefer to only state deprecation); ensure the
change is made in the anonymous async action that constructs the log/chalk
messages so the displayed cyan install command is corrected.
| ) | ||
|
|
||
| // Show deprecation warning if a legacy extension DB is detected | ||
| if (process.env.EXPERIMENTAL_NETLIFY_DB_ENABLED === '1' && databaseUrlEnv?.key === 'NETLIFY_DATABASE_URL') { |
There was a problem hiding this comment.
Deprecation warning guard is unreachable in the current command wiring.
src/commands/database/database.ts registers ./legacy/db-status.js only in the EXPERIMENTAL_NETLIFY_DB_ENABLED !== '1' branch, so this === '1' check prevents the warning from ever showing on that path.
Suggested fix
- if (process.env.EXPERIMENTAL_NETLIFY_DB_ENABLED === '1' && databaseUrlEnv?.key === 'NETLIFY_DATABASE_URL') {
+ if (databaseUrlEnv?.key === 'NETLIFY_DATABASE_URL') {📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (process.env.EXPERIMENTAL_NETLIFY_DB_ENABLED === '1' && databaseUrlEnv?.key === 'NETLIFY_DATABASE_URL') { | |
| if (databaseUrlEnv?.key === 'NETLIFY_DATABASE_URL') { |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/commands/database/legacy/db-status.ts` at line 81, The deprecation guard
in src/commands/database/legacy/db-status.ts uses if
(process.env.EXPERIMENTAL_NETLIFY_DB_ENABLED === '1' && databaseUrlEnv?.key ===
'NETLIFY_DATABASE_URL') which is unreachable because this legacy command is only
registered when EXPERIMENTAL_NETLIFY_DB_ENABLED !== '1'; change the condition so
the warning runs when the legacy command is active (e.g., flip the env check to
!== '1' or remove the env check entirely and only test databaseUrlEnv?.key ===
'NETLIFY_DATABASE_URL') so the deprecation message is actually emitted by the
legacy db-status command.
🤖 I have created a release *beep* *boop* --- ## [25.3.0](v25.2.0...v25.3.0) (2026-04-22) ### Features * add deprecation messaging for legacy Netlify DB extension ([#8141](#8141)) ([cb924d4](cb924d4)) ### Bug Fixes * match migration finding with netlify/build ([#8191](#8191)) ([e2e8267](e2e8267)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: token-generator-app[bot] <82042599+token-generator-app[bot]@users.noreply.github.com>
🎉 Thanks for submitting a pull request! 🎉
Summary
Adds deprecation messaging to the CLI for users of the legacy Netlify DB extension, ahead of the Netlify DB primitive GA launch on April 28. https://linear.app/netlify/issue/RUN-2729/update-cli-behavior-on-legacy-netlifydb
db init: Re-registered in the new CLI flow as an informational command. Instead of "command not found," users get a message that databases are now auto-provisioned via @netlify/database, plus a migration link for legacy extension users.db status: WhenNETLIFY_DATABASE_URLis detected (indicating a legacy extension DB), shows a deprecation warning with a link to ntl.fyi/db-migration after the normal status output.Both deprecation messages are gated behind
EXPERIMENTAL_NETLIFY_DB_ENABLEDso they won't be visible until GAOld CLI users are handled separately by extension-side gating (PR #255).
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)