Skip to content

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

Open
kathmbeck wants to merge 5 commits intomainfrom
ga-launch-migration
Open

feat: add deprecation messaging for legacy Netlify DB extension#8141
kathmbeck wants to merge 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 21. 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/db, 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.

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

coderabbitai bot commented Apr 8, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5cd6076a-c588-48de-a2f1-6286dd45795b

📥 Commits

Reviewing files that changed from the base of the PR and between 97b3b6f and 11c812f.

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

📝 Walkthrough

Summary by CodeRabbit

  • Deprecations
    • netlify db init command is no longer available; databases are now auto-provisioned when @netlify/db is detected. Users are prompted to run npm install @netlify/db``.
    • NETLIFY_DATABASE_URL environment variable usage displays a deprecation warning with migration guidance.

Walkthrough

In experimental mode (EXPERIMENTAL_NETLIFY_DB_ENABLED === '1'), createDatabaseCommand() now registers a db/database init subcommand whose action dynamically imports log/chalk and prints a deprecation message advising that netlify db init is removed and databases are auto-provisioned when @netlify/db is present, with instructions to run npm install @netlify/db`` and a migration URL when applicable. Separately, the status command conditionally appends a deprecation warning and migration URL to its output when the `NETLIFY_DATABASE_URL` environment variable is detected.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 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 directly aligns with the primary objectives of both file changes.
Description check ✅ Passed The description is directly related to the changeset, explaining the motivation and implementation details of the deprecation messaging for legacy Netlify DB extension users across both the db init and db status commands.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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 1b8171d

  • Dependency count: 1,060 (no change)
  • Package size: 354 MB ⬆️ 0.00% increase vs. 1b8171d
  • 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

@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

sarahetter
sarahetter previously approved these changes Apr 9, 2026
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@kathmbeck kathmbeck requested a review from sarahetter April 10, 2026 15:21
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.

2 participants