Skip to content

feat: re-structure db commands#8137

Merged
paulo merged 2 commits intomainfrom
pa/restructure-commands
Apr 7, 2026
Merged

feat: re-structure db commands#8137
paulo merged 2 commits intomainfrom
pa/restructure-commands

Conversation

@paulo
Copy link
Copy Markdown
Contributor

@paulo paulo commented Apr 7, 2026

Summary

  • Wrapped the db init command registration in the EXPERIMENTAL_NETLIFY_DB_ENABLED check
  • db migrate → db migrations apply (now a subcommand of migrations instead of a standalone command)
  • db migration renamed to db migrations (plural), so db migration new → db migrations new

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 7, 2026

📝 Walkthrough

Summary by CodeRabbit

Refactor

  • Updated database migration command structure: db migrate replaced with db migrations apply
  • Renamed migration management group from db migration to db migrations
  • Command examples updated accordingly
  • Changes apply when experimental database flag is enabled

Walkthrough

The database command structure was refactored to rename and reorganize migration-related subcommands. When the EXPERIMENTAL_NETLIFY_DB_ENABLED flag is set to '1', the db migrate subcommand is replaced with db migrations apply using the same handler. The migration management group was renamed from db migration to db migrations, with its new subcommand updated accordingly. The db init command registration is now conditional on the experimental flag being disabled. The top-level db command examples are updated to reflect these changes based on the flag state.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: restructuring of database commands, including renaming and reorganizing command hierarchies.
Description check ✅ Passed The description is directly related to the changeset, providing specific details about command restructuring, feature flag wrapping, and command renames.
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 pa/restructure-commands

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

📊 Benchmark results

Comparing with be7538b

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

@paulo paulo requested review from eduardoboucas and kathmbeck April 7, 2026 09:01
@paulo paulo marked this pull request as ready for review April 7, 2026 09:01
@paulo paulo requested a review from a team as a code owner April 7, 2026 09:01
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.

🧹 Nitpick comments (1)
src/commands/database/database.ts (1)

123-131: Consider adding examples for consistency.

The migrations apply subcommand lacks .addExamples() while the migrations new subcommand (lines 148-151) includes examples. Adding examples would maintain consistency and improve discoverability.

💡 Suggested addition
       .action(async (options: { to?: string; json?: boolean }, command: BaseCommand) => {
         const { migrate } = await import('./migrate.js')
         await migrate(options, command)
       })
+      .addExamples([
+        'netlify db migrations apply',
+        'netlify db migrations apply --to "add_users_table"',
+        'netlify db migrations apply --json',
+      ])
🤖 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 123 - 131, Add usage examples
for the "migrations apply" subcommand to match the "migrations new" style:
update the migrationsCommand.command('apply') chain to call .addExamples(...)
with one or more illustrative examples (e.g., applying all migrations and
applying up to a named migration) so users can discover common usage; locate the
.command('apply') block that invokes migrate(options, command) and append the
.addExamples(...) call to that chain.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/commands/database/database.ts`:
- Around line 123-131: Add usage examples for the "migrations apply" subcommand
to match the "migrations new" style: update the
migrationsCommand.command('apply') chain to call .addExamples(...) with one or
more illustrative examples (e.g., applying all migrations and applying up to a
named migration) so users can discover common usage; locate the
.command('apply') block that invokes migrate(options, command) and append the
.addExamples(...) call to that chain.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a0ee0c9c-1178-44be-bdcf-410d2f17d9eb

📥 Commits

Reviewing files that changed from the base of the PR and between be7538b and d780cd3.

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

@paulo paulo merged commit c28ffa3 into main Apr 7, 2026
71 checks passed
@paulo paulo deleted the pa/restructure-commands branch April 7, 2026 09:19
eduardoboucas pushed a commit that referenced this pull request Apr 9, 2026
🤖 I have created a release *beep* *boop*
---


## [24.11.0](v24.10.0...v24.11.0)
(2026-04-09)


### Features

* load connection string from env var
([#8142](#8142))
([e522b7e](e522b7e))
* pull DB migrations
([#8139](#8139))
([2a8f7c0](2a8f7c0))
* re-structure db commands
([#8137](#8137))
([c28ffa3](c28ffa3))

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

2 participants