Skip to content

feat: add deprecation messaging for legacy Netlify DB extension#8141

Merged
kathmbeck merged 5 commits intomainfrom
ga-launch-migration
Apr 22, 2026
Merged

feat: add deprecation messaging for legacy Netlify DB extension#8141
kathmbeck merged 5 commits intomainfrom
ga-launch-migration

Conversation

@kathmbeck
Copy link
Copy Markdown
Contributor

@kathmbeck kathmbeck commented Apr 8, 2026

🎉 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: When NETLIFY_DATABASE_URL is 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_ENABLED so they won't be visible until GA

Old 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:

  • Open a bug/issue before writing your code 🧑‍💻. This ensures we can discuss the changes and get feedback from everyone that should be involved. If you`re fixing a typo or something that`s on fire 🔥 (e.g. incident related), you can skip this step.
  • Read the contribution guidelines 📖. This ensures your code follows our style guide and
    passes our tests.
  • Update or add tests (if any source code was changed or added) 🧪
  • Update or add documentation (if features were changed or added) 📝
  • Make sure the status checks below are successful ✅

A picture of a cute animal (not mandatory, but encouraged)

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 8, 2026

📝 Walkthrough

Walkthrough

This change adds deprecation notices to two database-related CLI commands when the experimental Netlify database feature is enabled. The first file introduces a new init subcommand that displays a deprecation message directing users to install @netlify/database and providing migration guidance. The second file adds a conditional deprecation warning to the existing database status command output when the legacy NETLIFY_DATABASE_URL environment variable is detected. Both deprecation messages include links to migration documentation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding deprecation messaging for the legacy Netlify DB extension, which matches the core modifications in both modified files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The pull request description clearly relates to the changeset, explaining the addition of deprecation messaging for legacy Netlify DB with specific details about the two affected commands (db init and db status) and the feature's purpose ahead of GA launch.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ga-launch-migration

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 8, 2026

📊 Benchmark results

Comparing with 40e56cf

  • Dependency count: 1,061 (no change)
  • Package size: 355 MB (no change)
  • Number of ts-expect-error directives: 356 (no change)

@kathmbeck kathmbeck marked this pull request as ready for review April 9, 2026 17:47
@kathmbeck kathmbeck requested a review from a team as a code owner April 9, 2026 17:47
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0160b3c and 97b3b6f.

📒 Files selected for processing (2)
  • src/commands/database/database.ts
  • src/commands/database/status.ts

Comment thread src/commands/database/database.ts Outdated
sarahetter
sarahetter previously approved these changes Apr 9, 2026
kathmbeck and others added 4 commits April 22, 2026 12:08
@kathmbeck kathmbeck force-pushed the ga-launch-migration branch from 11c812f to 704a7b6 Compare April 22, 2026 16:22
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 11c812f and 704a7b6.

📒 Files selected for processing (2)
  • src/commands/database/database.ts
  • src/commands/database/legacy/db-status.ts

Comment on lines +109 to +121
.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')}`)
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 | 🔴 Critical

🧩 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:


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') {
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 | 🟠 Major

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.

Suggested change
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.

@kathmbeck kathmbeck merged commit cb924d4 into main Apr 22, 2026
69 checks passed
@kathmbeck kathmbeck deleted the ga-launch-migration branch April 22, 2026 17:04
eduardoboucas pushed a commit that referenced this pull request Apr 22, 2026
🤖 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants