feat: show migrations directory path in database status#8187
feat: show migrations directory path in database status#8187eduardoboucas merged 4 commits intomainfrom
database status#8187Conversation
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe database status command now surfaces the migrations directory path in its output. Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@tests/unit/commands/database/db-status.test.ts`:
- Around line 363-369: The tests call statusDb with createMockCommand(), but
createMockCommand injects db.migrations.path by default so they never exercise
the fallback resolution; update the tests that assert migrationsPath (the ones
using statusDb, jsonMessages and createMockCommand) to call createMockCommand
without the configured db.migrations.path (e.g., pass a mock command override
that omits or sets db.migrations.path to undefined) so the code computes the
default/fallback path and the assertions validate that resolved fallback value
instead of the injected config.
🪄 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: 16325f0d-d26d-4dac-b923-172056822c8e
📒 Files selected for processing (2)
src/commands/database/db-status.tstests/unit/commands/database/db-status.test.ts
| test('includes the resolved migrations directory in JSON output', async () => { | ||
| await statusDb({ json: true }, createMockCommand()) | ||
|
|
||
| expect(jsonMessages[0]).toMatchObject({ | ||
| migrationsPath: '/project/netlify/database/migrations', | ||
| }) | ||
| }) |
There was a problem hiding this comment.
Default-path tests are exercising configured-path behavior, not fallback resolution.
On Line 364 and Line 511, createMockCommand() injects db.migrations.path by default, so these tests don’t validate the no-config fallback path computation.
Suggested test fix
- test('includes the resolved migrations directory in JSON output', async () => {
- await statusDb({ json: true }, createMockCommand())
+ test('includes the resolved migrations directory in JSON output', async () => {
+ await statusDb({ json: true }, createMockCommand({ migrationsPath: null }))
expect(jsonMessages[0]).toMatchObject({
migrationsPath: '/project/netlify/database/migrations',
})
})- test('renders a dedicated line for the migrations directory', async () => {
- await statusDb({}, createMockCommand())
+ test('renders a dedicated line for the migrations directory', async () => {
+ await statusDb({}, createMockCommand({ migrationsPath: null }))
expect(logMessages.join('\n')).toContain('Migrations directory: /project/netlify/database/migrations')
})Also applies to: 510-514
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@tests/unit/commands/database/db-status.test.ts` around lines 363 - 369, The
tests call statusDb with createMockCommand(), but createMockCommand injects
db.migrations.path by default so they never exercise the fallback resolution;
update the tests that assert migrationsPath (the ones using statusDb,
jsonMessages and createMockCommand) to call createMockCommand without the
configured db.migrations.path (e.g., pass a mock command override that omits or
sets db.migrations.path to undefined) so the code computes the default/fallback
path and the assertions validate that resolved fallback value instead of the
injected config.
📊 Benchmark resultsComparing with 69f05af
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/commands/database/db-status.ts (1)
442-442: Consider renaming the JSON key for consistency.Line 442 uses
migrationsPath, while internal naming and UI usemigrationsDirectory. Aligning on one term would reduce mental mapping for consumers.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/commands/database/db-status.ts` at line 442, The JSON key currently uses migrationsPath but the codebase and UI use migrationsDirectory; update the object key from migrationsPath to migrationsDirectory (i.e., change the assignment "migrationsPath: migrationsDirectory" to "migrationsDirectory: migrationsDirectory") wherever that pattern appears (e.g., in the db-status construction or export that emits this JSON) so naming is consistent with internal identifiers and UI; if consumers expect the old key, consider adding a short compatibility shim that writes both keys or documents the change.
🤖 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/db-status.ts`:
- Line 442: The JSON key currently uses migrationsPath but the codebase and UI
use migrationsDirectory; update the object key from migrationsPath to
migrationsDirectory (i.e., change the assignment "migrationsPath:
migrationsDirectory" to "migrationsDirectory: migrationsDirectory") wherever
that pattern appears (e.g., in the db-status construction or export that emits
this JSON) so naming is consistent with internal identifiers and UI; if
consumers expect the old key, consider adding a short compatibility shim that
writes both keys or documents the change.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 79be1091-27ad-45e8-89a8-be0dece92266
📒 Files selected for processing (2)
src/commands/database/db-status.tstests/unit/commands/database/db-status.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- tests/unit/commands/database/db-status.test.ts
🤖 I have created a release *beep* *boop* --- ## [25.4.0](v25.3.0...v25.4.0) (2026-04-23) ### Features * show migrations directory path in `database status` ([#8187](#8187)) ([a378a02](a378a02)) * various improvements to `database` commands ([#8200](#8200)) ([2947a99](2947a99)) ### Bug Fixes * **deps:** update dependency @netlify/dev to v4.17.3 ([#8196](#8196)) ([0bc12bd](0bc12bd)) --- 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>
No description provided.