Skip to content

feat(migrate): add --url param for db pull, db push, migrate dev#28860

Merged
jkomyno merged 6 commits intomainfrom
feat/migrate-url
Dec 9, 2025
Merged

feat(migrate): add --url param for db pull, db push, migrate dev#28860
jkomyno merged 6 commits intomainfrom
feat/migrate-url

Conversation

@jkomyno
Copy link
Copy Markdown
Contributor

@jkomyno jkomyno commented Dec 5, 2025

This PR:

  • closes TML-1655
  • adds new optional --url CLI parameter to:
    • prisma db pull
    • prisma db push
    • prisma migrate dev

Whenever --url is passed, the config.datasource.url value is overridden.
This implies that the Prisma CLI commands listed above can be used without a Prisma config file, as long as the --url parameter is passed with a given string.

Summary by CodeRabbit

  • New Features

    • Added a --url option to db pull, db push, and migrate dev so commands can use an overriding datasource URL without changing the config file.
  • Tests

    • Added tests covering --url behavior for each command, validating behavior when a datasource exists and when no datasource is present.

✏️ Tip: You can customize this high-level summary in your review settings.

@jkomyno jkomyno added this to the 7.2.0 milestone Dec 5, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Dec 5, 2025

Walkthrough

Adds a --url CLI option to DbPull, DbPush, and MigrateDev that, when provided, is merged into a per-command config (overriding datasource.url) which is used for validation, setup, schema filtering, and extensions. Tests added to verify override and no-datasource cases.

Changes

Cohort / File(s) Change Summary
Command implementations
packages/migrate/src/commands/DbPull.ts, packages/migrate/src/commands/DbPush.ts, packages/migrate/src/commands/MigrateDev.ts
Add --url CLI option. When present, build a cmdSpecificConfig by merging the provided URL into datasource.url and use cmdSpecificConfig in validation, Migrate.setup/schema engine config, external tables/enums selection, shadow DB init, and extensions. Update help/argument text.
Tests
packages/migrate/src/__tests__/DbPull/sqlite.test.ts, packages/migrate/src/__tests__/DbPush.test.ts, packages/migrate/src/__tests__/MigrateDev.test.ts
Add two tests per suite: one asserting --url overrides an existing datasource URL in config, and one asserting --url works when no datasource exists. Tests run commands (with --print or equivalent) and assert stdout/schema/migration output via snapshots.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding a --url parameter to multiple db commands (pull, push, and dev), which is the core objective of this pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/migrate-url

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
Contributor

github-actions bot commented Dec 5, 2025

size-limit report 📦

Path Size
packages/client/runtime/index-browser.js 2.23 KB (0%)
packages/client/runtime/index-browser.d.ts 3.28 KB (0%)
packages/cli/build/index.js 2.51 MB (+0.02% 🔺)
packages/client/prisma-client-0.0.0.tgz 10.23 MB (0%)
packages/cli/prisma-0.0.0.tgz 6.71 MB (+0.01% 🔺)
packages/bundle-size/da-workers-libsql/output.tgz 805.3 KB (0%)
packages/bundle-size/da-workers-neon/output.tgz 859.22 KB (0%)
packages/bundle-size/da-workers-pg/output.tgz 852.16 KB (0%)
packages/bundle-size/da-workers-planetscale/output.tgz 804.74 KB (0%)
packages/bundle-size/da-workers-d1/output.tgz 788.21 KB (0%)

@jkomyno jkomyno marked this pull request as ready for review December 5, 2025 12:53
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Dec 9, 2025
@jkomyno jkomyno merged commit 235e6b5 into main Dec 9, 2025
246 checks passed
@jkomyno jkomyno deleted the feat/migrate-url branch December 9, 2025 12:15
@jkomyno jkomyno changed the title feat(migrate): add --url param for db pull, db push feat(migrate): add --url param for db pull, db push, migrate dev Dec 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants